Twitter API 1.1 test program. (use SuperTweet.net)
Dependencies: EthernetInterface HTTPClient mbed-rtos mbed
Twitter API V1.1とSuperTweetを使用してtweetするプログラムです。
オフィシャル版のHTTPClientではBASIC認証をサポートしていないので、Kazushi MukaiyamaさんのHTTPClientライブラリを使用しています。
Revision 0:05d2322a3ff3, committed 2013-06-15
- Comitter:
- kanpapa
- Date:
- Sat Jun 15 13:51:26 2013 +0000
- Child:
- 1:eb444d3c3739
- Commit message:
- 1st release.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Sat Jun 15 13:51:26 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/EthernetInterface/#5bb6706a2303
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPClient.lib Sat Jun 15 13:51:26 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/kazushi2008/code/HTTPClient/#cf5d7427a9ec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jun 15 13:51:26 2013 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "HTTPClient.h"
+
+EthernetInterface eth;
+HTTPClient twitter;
+char str[512];
+
+int main()
+{
+ eth.init(); //Use DHCP
+
+ eth.connect();
+
+ //POST data
+ HTTPMap map;
+ HTTPText inText(str, 512);
+ map.put("status", "I am tweeting from my mbed!");
+
+ printf("\nTrying to post data...\n");
+ twitter.basicAuth("myuser", "mypass"); //We use basic authentication, replace with you account's parameters
+ int ret = twitter.post("http://api.supertweet.net/1.1/statuses/update.json", map, &inText);
+ if (!ret)
+ {
+ printf("Executed POST successfully - read %d characters\n", strlen(str));
+ printf("Result: %s\n", str);
+ }
+ else
+ {
+ printf("Error - ret = %d - HTTP return code = %d\n", ret, twitter.getHTTPResponseCode());
+ }
+
+ eth.disconnect();
+
+ while(1) {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Sat Jun 15 13:51:26 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#58b30ac3f00e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jun 15 13:51:26 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file