GR-peach example of Dropbox shared link access
Dependencies: HTTPClient mbed-rtos-initial-thread-larger-stack mbed-src
Fork of GR-peach-HTTPSClient by
Diff: main.cpp
- Revision:
- 0:83075160de0e
- Child:
- 1:2744673f6256
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 03 06:10:26 2014 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" +#include "EthernetInterface.h" +#include "HTTPClient.h" + +#define SERVER_URL "https://192.168.1.12/index.html" + +EthernetInterface eth; +HTTPClient http; +char recvBuff[1024*20]; + +int main() +{ + int ret ; + + printf("HTTP Client, Starting,...\n") ; + + eth.init(); //Use DHCP + while(1) { + printf("Trying\n") ; + ret = eth.connect(); + if(ret == 0)break ; + } + printf("HTTP Client, IP Address is %s\n", eth.getIPAddress()); + + while(1) { + printf("\nTrying to fetch page... %s\n", SERVER_URL); + memset(recvBuff, '\0', sizeof(recvBuff)) ; + ret = http.get(SERVER_URL, recvBuff, sizeof(recvBuff),16); + + if (!ret) { + printf("Result: %s\n", recvBuff); + } else { + printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); + } + wait(10.0) ; + } + + eth.disconnect(); + + while(1) { + } +}