I am struggling with curl again…
I can make my curl script run just fine on Windows (cygwin64), OSX, and Raspbian (through ssh). However no version of what I use (escaped symbols or otherwise) will work with openHAB2.
Does work in Windows/OSX/Raspbian:
xtend
curl -X POST -H “Content-Type: application/json; charset=utf-8” -H “Authorization: bearer www-www-www-www” -d “” “http://mytaglist.com/ethClient.asmx/GetTagList”
Does NOT work in OH2:
```xtend```
curl -X POST -H \"Content-Type: application/json; charset=utf-8\" -H \"Authorization: bearer www-www-www-www\" -d \"\" \"http://mytaglist.com/ethClient.asmx/GetTagList\"
Rule:
php
rule "wireless curl execution"
when
Time cron "0 */5 * * * ?"
then
val String results = executeCommandLine(“curl -X POST -H “Content-Type: application/json; charset=utf-8” -H “Authorization: bearer www-www-www-www” -d “” “http://mytaglist.com/ethClient.asmx/GetTagList””, 5000)
logInfo(“Curl”, results)
end
Error:
2016-09-27 10:50:01.018 [INFO ] [.eclipse.smarthome.model.script.Curl] -
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
100 339 100 339 0 0 374 0 --:–:-- --:–:-- --:–:-- 374
Bad Request - Invalid Header
HTTP Error 400. The request has an invalid header name.
```I’ve tried escaping, not escaping, using @@ instead of spaces, rearranging the order of the headers, different encoding, different content types, but nothing I do returns the same result as it does via terminal/ssh/cygwin/cmd.
These variations also work in a terminal, but not in OH2 (when escaped):
xtend
curl -X POST -H “host: mytaglist.com” -H “Content-Type: application/json; charset=utf-8” -H “Authorization: bearer www-www-www-www” -d “” "http://mytaglist.com/ethClient.asmx/GetTagList"
curl -X POST -H “Content-Type: application/json; charset=utf-8” -H “Authorization: bearer www-www-www-www” -d “” “http://mytaglist.com/ethClient.asmx/GetTagList”
Thoughts?