I was wondering if there is any HTTP libraries made for AMX to do simple HTTP/REST/XML requests (i.e Posts). As i am unsure on how to establish a port as the Netlinx Help is not that helpful.
Sending a POST is just sending the string to your socket once it's open, terminated with two CRLF pairs. Unfortunately, different web entities are going to require different formats for the header and data inside the POST, and you are going to need to know exactly what they require before it will work. I have seen some RSS feeds, for example, that ignored any requests that didn't include a user-agent in the header. That part you are going to have to find out from the site you are accessing. Make certain, as well, that POST is what is needed, and not GET, some implementations are kind of murky on that. The intended use is clear enough, but not every site developer gets all that stuff straight.
You'll need to know what content-type your device is expecting. If you're replicating the posting of a web form, that will typically be x-www-form-urlencoded (and=content+will&look=like+this), but your best bet is to use the Developer Tools/F12 function on your web browser and find out what's actually being sent by their web client (if there is one). As DH mentioned, you may need to add other headers to make the device happy. Post a link to the API reference and I can take a look if you like.
Oh, and you'll want to close the connection after you get a response, and open a new one for the next command, unless you want to mess with HTTP/1.1 connection handling, which I've never paid attention to.
Comments
Oh, and you'll want to close the connection after you get a response, and open a new one for the next command, unless you want to mess with HTTP/1.1 connection handling, which I've never paid attention to.