Arduino Enet get HTTP response
hi,
i need fetch http response. not 1 char, entire thing.
so far have code, works perfectly:
pin 9 buzzer, btw.
so can send data pages. want function return page responded with. best way this?
thanks!
i need fetch http response. not 1 char, entire thing.
so far have code, works perfectly:
code: [select]
void httprequest(byte *server, char *url)
{
client client(server, 80);
if (client.connect())
{
// serial.print("sending req...");
client.print("get /");
client.print(url);
client.println(" http/1.0");
client.println();
client.flush();
client.stop();
}
else
{
analogwrite(9, 100);
delay(5000);
analogwrite(9, 0);
}
} pin 9 buzzer, btw.
so can send data pages. want function return page responded with. best way this?
thanks!
the example sketch webclient using this:
you want parse throught headers, or "\r\n\r\n" if want skip headers , meaty html.
i design web page simple possible (have 1 word on page) , have arduino - if in control of web server, is...
code: [select]
void loop()
{
if (client.available()) {
char c = client.read();
[glow]// c has data web server.[/glow] serial.print(c);
}
if (!client.connected()) {
serial.println();
serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}you want parse throught headers, or "\r\n\r\n" if want skip headers , meaty html.
i design web page simple possible (have 1 word on page) , have arduino - if in control of web server, is...
Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Arduino Enet get HTTP response
arduino
Comments
Post a Comment