HTTP POST and return body handle

the http client library is perfect for returning the data, it will give you a status code… which will be something like 200 or 400 maybe 500 (if your php code is anything like mine). but it will also give you the body in “response.body”. the library is available in the libraries in the webIDE, I made an update to the library last week to make it work a little faster, though i haven’t had a chance to test it thoroughly yet. you can find the updated code in this thread

once you have the response.body you can pass the json and get keys and values so your code can then unlock doors or whatever

the required bits are the URL or IP, and the port number, the type - POST as you said above, any other headers your server needs. but im sure you know all these! then there is content length… we can calculate that once we know what else we are sending. so what does the server require in the post request… will it be anything besides reading a tag and sending it to the server with a single “tag”:“2138378394789123”

and what are the responses?

One thing you will have to be careful of is mySQL injections, the core can only do http so you will have to do lots of your own security checking and filtering to make sure your DB stays secure… i guess for one offs closed source security through obscurity stuff its ok… I dont know much about it myself but i’m paranoid

to parse the json you can have a look at this awesome piece of code… actually it has the tcp stuff too… so a great place to start.

1 Like