Networking stack: HTTP Client example

Dependencies:   mbed

HttpClientExample.cpp

Committer:
donatien
Date:
2010-05-25
Revision:
1:8dbebfb735c0
Child:
2:58122a485856

File content as of revision 1:8dbebfb735c0:

#include "mbed.h"
#include "EthernetNetIf.h"
#include "HttpClient.h"

EthernetNetIf eth; 
HttpClient http;
  
int main() {

  printf("Start\n");

  eth.setup();
  HttpText txt;
  
  HttpResult r = http.get("http://mbed.org/media/uploads/donatien/hello.txt", &txt);
  if(r==HTTP_OK)
  {
    printf("Result :\"%s\"\n", txt.gets()); 
  }
  else
  {
    printf("Error %d\n", r);
  }
  
  while(1)
  {
  
  }
}