# POST XML variables into CGI based website

**URL:** <https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834>\
**Category:** General\
**Created:** [18 March 2021 17:17 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834 "2021-03-18T17:17:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aa0z](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aa0z](https://discourse.nodered.org/u/aa0z)\
**Post date:** [18 March 2021 17:17 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834/1 "2021-03-18T17:17:58Z")

</div>

My website skills on 90's websites are not the best....I'm working on a flow that takes XML ham radio info and injects a website based on certain criteria.

Here is the http request node.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/946adfd0319310022ba596e4f156fb335e408f18.png)

The full URL is

`> http://cwfun.org/cgi-bin/funspots.cgi?dir=moqp&station=W0MA&frequency=7000&comment=testing&poster=W1AW&submit=Post`

I'm assuming this is how you input something into a form with the PUT command, or is there another way? I would think it would be a POST, but it didn't work correctly.

Can someone point me in the direction on how I pass variables and input them for station, frequency, comment & poster into the URL?

Kyle

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 March 2021 18:56 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834/2 "2021-03-18T18:56:55Z")

</div>

msg.payload is set in the inject node, it contains the station, frequency, comment, etc. You can do same for post or put.  
example -

```auto
[{"id":"626ab5fa.24dc24","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"dir\":\"moqp\",\"station\":\"W0MA\",\"frequency\":\"7000\",\"comment\":\"testing\",\"poster\":\"W1AW\",\"submit\":\"Post\"}","payloadType":"json","x":100,"y":2520,"wires":[["6c55d18d.ea2fb"]]},{"id":"6c55d18d.ea2fb","type":"http request","z":"5a245aa1.510164","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://cwfun.org/cgi-bin/funspots.cgi","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":2520,"wires":[["5718d21f.aeb06c"]]},{"id":"5718d21f.aeb06c","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":480,"y":2520,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![aa0z](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aa0z](https://discourse.nodered.org/u/aa0z)\
**Post date:** [18 March 2021 22:41 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834/3 "2021-03-18T22:41:36Z")

</div>

Thanks for the reply but are you sure that works?

I just loaded that flow and injected and it didn't post to the website.

Thanks  
Kyle

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [19 March 2021 00:29 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834/4 "2021-03-19T00:29:17Z")

</div>

When I tried i received a 200 status code and at html table response.

 ![Screenshot_20210319-002511](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/432f059680a290ba86022df54de8f13c7e2f7dec.png)  
Not knowing the backend what the server did with the posted data I have no idea.

tried GET and it worked e.g.

```auto
[{"id":"6c55d18d.ea2fb","type":"http request","z":"5a245aa1.510164","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"http://cwfun.org/cgi-bin/funspots.cgi","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":2520,"wires":[["5718d21f.aeb06c"]]},{"id":"5718d21f.aeb06c","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":480,"y":2520,"wires":[]},{"id":"626ab5fa.24dc24","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"dir\":\"moqp\",\"station\":\"WORKED\",\"frequency\":\"7000\",\"comment\":\"testing\",\"poster\":\"W1AW\",\"submit\":\"Post\"}","payloadType":"json","x":100,"y":2520,"wires":[["6c55d18d.ea2fb"]]}]

```

As you can see the top line says worked

 ![Screenshot_20210319-071928](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6ff9a513282ca969a5011692b9e4f8041662b8d.png)  
Also PUT works and returns 302  
eg.

```auto
[{"id":"626ab5fa.24dc24","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"dir=moqp&station=W0MA&frequency=7000&comment=testing&poster=W1AW&submit=Post","payloadType":"str","x":100,"y":2520,"wires":[["6c55d18d.ea2fb"]]},{"id":"6c55d18d.ea2fb","type":"http request","z":"5a245aa1.510164","name":"","method":"PUT","ret":"txt","paytoqs":"query","url":"http://cwfun.org/cgi-bin/funspots.cgi","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":2520,"wires":[["5718d21f.aeb06c"]]},{"id":"5718d21f.aeb06c","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":480,"y":2520,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![aa0z](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@aa0z](https://discourse.nodered.org/u/aa0z)\
**Post date:** [19 March 2021 10:52 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834/5 "2021-03-19T10:52:04Z")

</div>

> [@E1cid](#):
>
> `[{"id":"626ab5fa`

Yes, got it this time. Thank you for your time and knowledge! It worked!

---

<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:** [18 May 2021 10:52 UTC](https://discourse.nodered.org/t/post-xml-variables-into-cgi-based-website/42834/6 "2021-05-18T10:52:20Z")

</div>

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