Example HTTP client executing a script that returns the time

Dependencies:   mbed lwip

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Tue Mar 09 22:41:50 2010 +0000
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
precomp.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r bfe880f1e711 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 09 22:41:50 2010 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "HTTPClient.h"
+
+DigitalOut led(LED1);
+HTTPClient http;
+
+/* 
+  execute a php script that returns the time
+  
+  <?php
+  print strftime('%c');
+  ?>
+
+*/
+
+
+int main(void) {
+
+  char result[64];
+  const char url[] = "http://mbed5.dh.bytemark.co.uk/~chris/time.php";
+  printf ("Fetching from : %s\n",url);
+  
+  http.get(url, result);
+
+  // Display the page content:
+  printf("Result is: %s\n", result);
+
+  // Work is done!
+  while(1) {
+    led = !led;
+    wait(0.2);
+  }
+}
diff -r 000000000000 -r bfe880f1e711 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 09 22:41:50 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0
diff -r 000000000000 -r bfe880f1e711 precomp.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/precomp.lib	Tue Mar 09 22:41:50 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_unsupported/code/lwip/
\ No newline at end of file