Go Down

Topic: How to read body from an http respone? (Read 3555 times) previous topic - next topic

coll_1997

I am trying to read the body from this http response:


Code: [Select]
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Connection: close\r\n\r\n");


And then I read the response like this:


   
Code: [Select]
while(client.available()){
   
    String line = client.readStringUntil('\r');
    Serial.println(line);
   
  }


This works good and return this:

Requesting URL: /output/****.csv?colors=11
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With
Content-Type: text/plain
Transfer-Encoding: chunked
Date: Sat, 17 Jun 2017 08:09:31 GMT
Connection: close
Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Cache-control: private

34
colors,day,timestamp
11,12,2017-06-17T07:48:10.619Z


0

But I just want the body  :'(  Anyone can help me please?

sandeepmistry


Go Up