Hey, does anyone have a better library or an example on how to send GET/POST messages to a server? I tried to get the SparkFun library working with this shield but that didn’t work even when I swapped out the SoftwareSerial with a custom one. I don’t really feel like writing my own REST wrapper for this shield so any example is better than nothing.
Wow! Thank you so much. Why isn’t this somewhere on the wiki – or somewhere searchable. I looked all over github and google for a library like this.
I am going to add code to parse out the header/body and put the source up on github. That way nobody else has to look all over for the library for seeed wifly.
If I just do a while loop and print out the entire response I get the whole message. If I do some logic to parse the message (via the HttpClient) I don’t even finish reading through the header. I am guessing that the logic takes to long and the WiFly rejects some of the response since the buffer is full. It could also be the SoftwareSerial buffer but I am not too sure. I could always just read in the entire response and then parse it but I don’t think that using all that memory would be a good idea. Has anyone seen this behavior when attempting to parse a webserver response?
Ahhh… I found my issue. For some reason there was a delay built into the library when the shield didn’t have any data coming in. I will post up the combined library after I clean this up a bit.
Right now I can successfully make a request to httpbin and get a value from the json. I ended up using the jsmn/json_arduino lib since I feel that the other library (aJson) is pretty big. Because of this, I am not sure if the json parser can parse complex objects.
I am not sure about the ETA on this combined library as I only get a few hours a day to work on it but I think that I should have something to show by the end of the weekend. Right now I am just cleaning up the code and making sure I didn’t create any memory leaks – I haven’t touched c/c++ in years haha.