I am trying to use HTTP GET to get the content from the api at this page: jsonparsingdemo-cec5b.firebaseapp.com/jsonData/moviesDemoItem.txt
Here is my code:
#include <HttpClient.h>
unsigned int nextTime = 0; // Next time to contact the server
HttpClient http;
http_header_t headers[] = {
{ "Accept" , "*/*"},
{ NULL, NULL } // NOTE: Always terminate headers will NULL
};
http_request_t request;
http_response_t response;
void setup() {
Serial.begin(9600);
}
void loop() {
if (nextTime > millis()) {
return;
}
Serial.println();
Serial.println("Application>\tStart of Loop.");
request.hostname = "jsonparsingdemo-cec5b.firebaseapp.com";
request.port = 80;
request.path = "/jsonData/moviesDemoItem.txt";
http.get(request, response, headers);
Serial.print("Application>\tResponse status: ");
Serial.println(response.status);
Serial.print("Application>\tHTTP Response Body: ");
Serial.println(response.body);
nextTime = millis() + 10000;
}
Here is my output:
Application> Start of Loop.
Application> Response status: 301
Application> HTTP Response Body:
I get nothing in the body. Let me know if anyone knows how to get this working. Thank you.