-->
Page 2 of 6

Re: Skip HTTP Header from GET request

PostPosted: Wed Aug 31, 2016 11:22 am
by Luiz Henrique
martinayotte wrote:It has nothing with a library.
You simply need to create a for loop that will skip the unneeded characters until you find "\r\n\r\n" substring.
It can be done with something like (untested):
Code: Select allchar *ptr = buffer;
int len = strlen(buffer);
for (int = 0; i < len; i++) {
    if (strncmp(ptr++, "\r\n\r\n", 4) == 0) break;
}
ptr += 3;
Serial.println(ptr);


Hmmmm, ok, i will test this.
Just another question, this i put between that 2 lines, correct?

Code: Select alluint32_t len = wifi.recv(buffer, sizeof(buffer), 10000);


Your code


Code: Select all if (len > 0) {
        Serial.print("Received:[");
        for(uint32_t i = 0; i < len; i++) {
            Serial.print((char)buffer[i]);
        }
        Serial.print("]\r\n\r\n");
  }

Re: Skip HTTP Header from GET request

PostPosted: Wed Aug 31, 2016 11:35 am
by martinayotte
Yes ! between the wifi.recv and the rest of the code.
But, as you can see, I've already printed the result with a single Serial.print(ptr), so no need to keep your "for loop" for printing, especially that printing one character at a time is pretty slow and useless... :ugeek:

Re: Skip HTTP Header from GET request

PostPosted: Wed Aug 31, 2016 12:33 pm
by Luiz Henrique
martinayotte wrote:Yes ! between the wifi.recv and the rest of the code.
But, as you can see, I've already printed the result with a single Serial.print(ptr), so no need to keep your "for loop" for printing, especially that printing one character at a time is pretty slow and useless... :ugeek:


Yes, that's is my problem. Can I change the library for ESP8266Wifi? https://github.com/esp8266/Arduino#installing-with-boards-manager

I don't understand how i change the Serial in this Library above for my case...

Re: Skip HTTP Header from GET request

PostPosted: Wed Aug 31, 2016 4:58 pm
by martinayotte
It is not clear what was your previous setup ...
Was it an Arduino connected with an ESP using AT firmware ?
The ESP8266WiFi is for an ESP stand-alone (without any Arduino).