Pages: [1]   Go Down
Author Topic: HTTP Request and Response  (Read 328 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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?
« Last Edit: September 14, 2013, 03:10:14 pm by junkrar » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Pages: [1]   Go Up
Jump to: