Getting information from a CGI web service

Hi,

I have a system that provides me the temperature in a room via a simple CGI webservice:

user1@mojito:~# time wget -q -O - http://192.168.2.6/cgi-bin/ws3.cgi?item=garagem\&value=1\&action=get

<html>
<head>
<title>Web service CGI</title>
</head>

result == 16.25

</html>
real    0m 1.22s
user    0m 0.00s
sys     0m 0.00s


This takes approximately 1.2 seconds to get an answer because the system has to pool the sensor.

Now, trying to get the same information in nodered with a http request node, I'm using the whole string in the URL field:

http://192.168.2.6/cgi-bin/ws3.cgi?item=garagem\&value=1\&action=get

I get immediately (less than 1 second, for sure) the following message:

<html>
<head>
<title>Web service CGI</title>
</head>

result == 

</html>

So, no answer in the result field. I guess it is because nodered doesn't wait for the answer, that takes ~1.2 seconds.

I'm just testing with a simple setup: Inject node --> http request node --> debug node

[{"id":"a85278c5d29eb6c6","type":"debug","z":"ceded9b0.5f6278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1320,"y":500,"wires":[]},{"id":"5aea2f71a10a8a07","type":"http request","z":"ceded9b0.5f6278","name":"temp garagem","method":"GET","ret":"txt","paytoqs":"body","url":"http://192.168.2.6/cgi-bin/ws3.cgi?item=garagem\\&value=1\\&action=get","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{},"x":1100,"y":500,"wires":[["a85278c5d29eb6c6"]]},{"id":"db1a59c6a15938bc","type":"inject","z":"ceded9b0.5f6278","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":910,"y":500,"wires":[["5aea2f71a10a8a07"]]}]

I've also tried the different options in the http request node, but no luck....

Any suggestion to make this work?

Thanks

You have left in the BASH escaping of the URL. Take out the back-slashes.

It worked! Thanks !


<html>
<head>
<title>Web service CGI</title>
</head>

result == 16.437

</html>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.