Go Down

Topic: HTTP Request and Response (Read 1 time) previous topic - next topic


Sep 13, 2013, 03:23 am Last Edit: Sep 14, 2013, 10:10 pm by junkrar Reason: 1
I'm currently looking to send an HTTP request to a page that contains purely JSON. I hope to be able to read and parse this json code using the Arduino libraries. I have a WiFi shield which I'm using to connect (successfully) and I think I'm able to send an HTTP request using the client, but I'm not sure how to read the response. I'm finding very little information on this in my searches.

My current code can be found at [removed] (I've tried to remove the extra stuff that has nothing to do with this to clean it up, though I think the commented out jsonParse function remains). In the loop() function, the
Code: [Select]
if(!client.available()) test returns false, implying that the client IS available. However, the HTTP response is unrecognized (but that's just using the find() function I obtained from some other example code, the Twitter MoodLamp example I can link to if desired). What can I do at this point to obtain the HTTP Response body, AKA the JSON?


test returns false, implying that the client IS available.

That doesn't mean the client is available but there is data available in the client's input buffer.

You didn't tell us what output that code produces. Usually the way to go is putting out everything received from the server so you see what exactly the arduino receives. Then you can add some filtering and start parsing the content.

Go Up