Tiny HTTP Client http://mbed.org/users/okini3939/notebook/tinyhttp

Dependencies:   EthernetNetIf mbed

Revision:
0:f2bf5f966801
Child:
2:764ecec3dc59
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 27 16:08:54 2011 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "TCPSocket.h"
+#include "TinyHTTP.h"
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+EthernetNetIf eth;
+
+int main () {
+    EthernetErr ethErr;
+    Host host;
+    int r;
+
+    myled = 1;
+
+    ethErr = eth.setup();
+    if(ethErr) {
+        return -1;
+    }
+
+    host.setName("mbed.org");
+    r = httpRequest(METHOD_GET, &host, "/", NULL, NULL);
+/*
+    host.setName("www.domain.name");
+    r = httpRequest(METHOD_POST, &host, "/xxx.cgi", "Content-Type: application/x-www-form-urlencoded\r\n", "key=value&key2=value2");
+*/
+    printf("status %d\r\n", r);
+
+    myled = 0;
+    return 0;
+}