The Ethernet-Board

Dependencies:   EthernetInterface HTTPClient MODSERIAL mbed-dev mbed-rtos wolfSSL

Fork of sose2016_tr_oauth_pop by niko gillen

Revision:
0:64d0faaa4e6e
Child:
1:5f0df6a77d62
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 16 18:46:16 2016 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "HTTPClient.h"
+
+DigitalOut myled(PTB21);
+EthernetInterface eth;
+HTTPClient http;
+char str[64000];
+
+int main() {
+    setbuf(stdout, NULL);
+    eth.init(); //Use DHCP
+    eth.connect();
+    
+    printf("\nTrying to fetch page...\n");
+    //int ret = http.get("https://kongsugar.de/text.txt", str, 128);
+    int ret = http.get("https://kongsugar.de/text.txt", str, 64000);
+
+    if (!ret)
+    {
+      printf("Page fetched successfully - read %d characters\n", strlen(str));
+      printf("Result: %s\n", str);
+      myled=!myled;
+      myled=!myled;
+    }
+    else
+    {
+      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
+    }
+    while(1) {
+        
+    }
+    eth.disconnect();  
+}