POST XML variables into CGI based website

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.

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

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

[{"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":[]}]

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

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


Not knowing the backend what the server did with the posted data I have no idea.

tried GET and it worked e.g.

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


Also PUT works and returns 302
eg.

[{"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":[]}]

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

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