Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetNetIf mbed
HTTPClientExample.cpp
00001 #include "mbed.h" 00002 #include "EthernetNetIf.h" 00003 #include "HTTPClient.h" 00004 00005 EthernetNetIf eth; 00006 /*EthernetNetIf eth( 00007 IpAddr(192,168,0,110), //IP Address 00008 IpAddr(255,255,255,0), //Network Mask 00009 IpAddr(192,168,0,1), //Gateway 00010 IpAddr(192,168,0,1) //DNS 00011 );*/ 00012 00013 HTTPClient http; 00014 00015 int main() { 00016 00017 printf("Setting up...\n"); 00018 EthernetErr ethErr = eth.setup(); 00019 if(ethErr) 00020 { 00021 printf("Error %d in setup.\n", ethErr); 00022 return -1; 00023 } 00024 printf("Setup OK\n"); 00025 00026 HTTPText txt; 00027 00028 HTTPResult r = http.get("http://tnt.etf.rs/~oe4irs/pmk.txt", &txt); 00029 if(r==HTTP_OK) 00030 { 00031 printf("Result :\"%s\"\n", txt.gets()); 00032 } 00033 else 00034 { 00035 printf("Error %d\n", r); 00036 } 00037 00038 while(1) 00039 { 00040 00041 } 00042 00043 return 0; 00044 00045 }
Generated on Mon Jul 18 2022 01:28:22 by
1.7.2