Hi, I want to take data from a server and process it. I was able to query the server and it returns data to the serial monitor. My question is how can I get the data without the header and compare it to a code inside the arduino sketch?
Can anybody help me?
This is my arduino code:
#include <EtherCard.h>
#define ethCSpin 10
static byte mymac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "192.168.88.12";
static void response (byte status, word off, word len) {
Ethernet::buffer[off + len] = 0;
char* fullResponse = (char*) Ethernet::buffer + off;
Serial.println(fullResponse);
//Serial.println("...");
}
void setup () {
Serial.begin(9600);
static byte myip[] = { 192, 168, 88, 116 };
static byte gwip[] = { 192, 168, 88, 1 };
static byte dnsip[] = { 192, 168, 88, 1 };
for (;;) {
Serial.println(F("Reseting Ethernet..."));
if (ether.begin(sizeof Ethernet::buffer, mymac, ethCSpin) == 0) {
Serial.println(F("Failed to access Ethernet controller"));
continue;
}
ether.staticSetup(myip, gwip, dnsip);
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
ether.hisport = 8060;
ether.parseIp(ether.hisip, "88.87.3.67");
ether.printIp("SRV: ", ether.hisip);
break;
}
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
ether.browseUrl(PSTR("/"), "php/tryjson.php", website, response);
ether.persistTcpConnection(true);
}
// delay(5000);
}
This is server response:
HTTP/1.1 200 OK
Date: Wed, 08 Apr 2020 19:03:19 GMT
Server: Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.10
X-Powered-By: PHP/7.2.10
Content-Length: 7
Connection: close
Content-Type: text/html; charset=UTF-8
83.50