I am having a problem that will have an obvious solution when someone points out what I am missing, but until then I am stuck.
I am accessing weather data from the following webpage:
http://api.worldweatheronline.com/free/v2/weather.ashx?q=76112&format=xml&num_of_days=1&date=today&cc=no&tp=24&key=abcdefg1234567890
It works fine in a browser.
But the following simple code truncates the data after just a few characters received:
#include "HttpClient.h"
HttpClient http;
// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
// { "Content-Type", "application/json" },
// { "Accept" , "application/json" },
{ "Accept" , "*/*"},
{ NULL, NULL } // NOTE: Always terminate headers will NULL
};
http_request_t request;
http_response_t response;
void setup()
{
delay (10000); // Allow 10 seconds to get terminal going.
Serial.begin(9600);
Serial.println();
Serial.println("Today weather query");
request.hostname = "api.worldweatheronline.com";
request.port = 80;
request.path = "/free/v2/weather.ashx?q=76112&format=xml&num_of_days=1&date=today&cc=no&tp=24&key=abcdefghijkl1234567";
http.get(request, response, headers);
Serial.println (response.body);
Serial.println("End of data reached succesfully");
}
void loop()
{
}
Help?!?!