Arduino Enet get HTTP response


hi,

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:

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

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums