The Ethernet-Board

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

Fork of sose2016_tr_oauth_pop by niko gillen

Revision:
2:1ffd9e2ce7df
Parent:
1:5f0df6a77d62
Child:
3:e91a03086c72
--- a/main.cpp	Sat Jun 18 11:34:56 2016 +0000
+++ b/main.cpp	Sat Jun 18 11:55:54 2016 +0000
@@ -15,6 +15,7 @@
     setbuf(stdout, NULL);
     eth.init(); //Use DHCP
     eth.connect();
+    http.dumpResHeader(true);
 
     while(1){
         // Wait for Token on Serial and read to str
@@ -27,12 +28,14 @@
         printf(str);
         
         // Send token to Server
-        http.dumpResHeader(true);
-        // GET date, more examples on https://developer.mbed.org/users/donatien/code/HTTPClient_HelloWorld/file/270e2d0bb85a/main.cpp
+        // POST date, more examples on https://developer.mbed.org/users/donatien/code/HTTPClient_HelloWorld/file/270e2d0bb85a/main.cpp
         printf("\nTrying to fetch page...\n");
-        //int ret = http.get("https://kongsugar.de/text.txt", str, 128);
-        int ret = http.get("https://46.101.218.232/text.txt", str, 64000);
-    
+        HTTPMap map;
+        HTTPText inText(str, 512);
+        map.put("Hello", "World");
+        map.put("test", "1234");
+        printf("\nTrying to post data...\n");
+        int ret = http.post("http://httpbin.org/post", map, &inText);    
         if (!ret)
         {
           printf("Page fetched successfully - read %d characters\n", strlen(str));