Dependencies:   EthernetNetIf mbed HTTPClient_ToBeRemoved

Files at this revision

API Documentation at this revision

Comitter:
jksoft
Date:
Sat Apr 28 07:21:13 2012 +0000
Commit message:

Changed in this revision

EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
TwitterExample.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Sat Apr 28 07:21:13 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPClient.lib	Sat Apr 28 07:21:13 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPClient/#d0be6af2d1db
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TwitterExample.cpp	Sat Apr 28 07:21:13 2012 +0000
@@ -0,0 +1,48 @@
+/*
+  Update: 21-06-2010
+  The basic authentication service for twitter is going down at the end of the week.
+  To continue using that program, the code has been updated to use http://supertweet.net which acts as an API proxy.
+  Simply visit the website to setup your twitter account for this API.
+  See: http://www.supertweet.net/about/documentation
+*/
+
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "HTTPClient.h"
+
+EthernetNetIf eth; 
+
+int main() {
+
+  printf("Init\n");
+
+  printf("\r\nSetting up...\r\n");
+  EthernetErr ethErr = eth.setup();
+  if(ethErr)
+  {
+    printf("Error %d in setup.\n", ethErr);
+    return -1;
+  }
+  printf("\r\nSetup OK\r\n");
+
+  HTTPClient twitter;
+  
+  HTTPMap msg;
+  msg["status"] = "I am tweeting from my mbed!"; //A good example of Key/Value pair use with Web APIs
+
+  twitter.basicAuth("", ""); //We use basic authentication, replace with you account's parameters
+  
+  //No need to retieve data sent back by the server
+  HTTPResult r = twitter.post("http://api.supertweet.net/1/statuses/update.xml", msg, NULL); 
+  if( r == HTTP_OK )
+  {
+    printf("Tweet sent with success!\n");
+  }
+  else
+  {
+    printf("Problem during tweeting, return code %d\n", r);
+  }
+  
+  return 0;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Apr 28 07:21:13 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da