# Getting information from a CGI web service

**URL:** <https://discourse.nodered.org/t/getting-information-from-a-cgi-web-service/54921>\
**Category:** General\
**Tags:** http-request\
**Created:** [9 December 2021 12:03 UTC](https://discourse.nodered.org/t/getting-information-from-a-cgi-web-service/54921 "2021-12-09T12:03:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jabss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jabss/32/34422_2.png) [@jabss](https://discourse.nodered.org/u/jabss)\
**Post date:** [9 December 2021 12:03 UTC](https://discourse.nodered.org/t/getting-information-from-a-cgi-web-service/54921/1 "2021-12-09T12:03:50Z")

</div>

Hi,

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

```auto
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:

```auto
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:

```auto
<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

```auto
[{"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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [9 December 2021 13:58 UTC](https://discourse.nodered.org/t/getting-information-from-a-cgi-web-service/54921/2 "2021-12-09T13:58:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jabss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jabss/32/34422_2.png) [@jabss](https://discourse.nodered.org/u/jabss)\
**Post date:** [9 December 2021 14:30 UTC](https://discourse.nodered.org/t/getting-information-from-a-cgi-web-service/54921/3 "2021-12-09T14:30:39Z")

</div>

It worked! Thanks !

```auto

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

result == 16.437

</html>

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 December 2021 14:30 UTC](https://discourse.nodered.org/t/getting-information-from-a-cgi-web-service/54921/4 "2021-12-23T14:30:58Z")

</div>

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