I am getting data from one page.
These are the data:
HTTP/1.1 200 OK
Connection: close
Date: Thu, 17 Mar 2016 19:38:06 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-Powered-By: PHP/5.4.9
Set-Cookie: PHPSESSID=a9f0n7608v29g9tbkle4ra7n17; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html; charset=UTF-8
Content-Length: 94primeiro_quotefim_mod_ini_mod_ry1=l_ry2=l_ry3=d_ry4=dfim_mod_ini_mod_ry1=lfim_mod_ultimo_quote
I'm using 'primeiro_quote' and 'ultimo_quote' as marks for cutting. When the String received is short it works, but with a big string there is no cut.
This is the code:
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "arrobaserver.wha.la";
//char website[] PROGMEM = "google.com";
String retorno;
// called when the client request is complete
static void my_callback (byte status, word off, word len) {
Serial.println(">>>");
Ethernet::buffer[off + 800] = 0;
retorno = ((const char*) Ethernet::buffer + off);
Serial.println(retorno);
retorno = retorno.substring(retorno.indexOf("primeiro_quote")+14,retorno.indexOf("ultimo_quote"));
Serial.println(retorno);
}
void setup () {
Serial.begin(57600);
Serial.println("\n[webClient]");
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 15000;
Serial.println();
Serial.print("<<< REQ ");
ether.hisport = 8082;//to access local host
ether.browseUrl(PSTR("/asp/haroldo/bms/ver.php"), "?predio=1&arduino=1", website, my_callback);
}
}