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: HTTPClient mbed-rtos-initial-thread-larger-stack mbed-src
Fork of GR-peach-HTTPSClient by
main.cpp
- Committer:
- takashikojo
- Date:
- 2014-12-05
- Revision:
- 1:2744673f6256
- Parent:
- 0:83075160de0e
File content as of revision 1:2744673f6256:
#include "mbed.h"
#include "EthernetInterface.h"
#include "HTTPClient.h"
#define SHARED_LINK "https://www.dropbox.com/s/m856g2irwzb68uv/test.txt?dl=0"
extern HTTPResult dropbox_get(const char *url, char *buff, int size) ;
EthernetInterface eth;
HTTPClient http;
char recvBuff[1024*20];
int main()
{
HTTPResult ret ;
printf("Dropbox Shared Link, Starting,...\n") ;
eth.init(); //Use DHCP
while(1) {
printf("Trying\n") ;
if(eth.connect() == 0)break ;
}
printf("HTTP Client, IP Address is %s\n", eth.getIPAddress());
printf("Shared Link: %s\n", SHARED_LINK);
memset(recvBuff, '\0', sizeof(recvBuff)) ;
ret = dropbox_get(SHARED_LINK, recvBuff, sizeof(recvBuff));
if (ret == HTTP_OK) {
printf("Result: %s\n", recvBuff);
} else {
printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
}
eth.disconnect();
while(1) {
}
}
