Hi Jacob.
Yes, sure.
It's a modified snipped from the Botanicalls project based on Arduino:
http://www.botanicalls.com/
The original code can be downloaded here:
http://www.botanicalls.com/code/BotanicallsTwitter_v2.15.zip
Further information concerning arduino can be found here:
http://www.arduino.cc
As you can see, I hardcoded the Supertweet api adress as host and
added the right content type (thanks Mr Blog). In comparison to the
original (check "twitter.pde") I added a "_nl" fragment to several
putstring commands.
// send the HTTP command, ie "GET /username/"
putstringSS("POST ");
putstringSS(HTTPPATH);
putstringSS_nl(" HTTP/1.1");
putstring("POST ");
putstring(HTTPPATH);
putstring_nl(" HTTP/1.1");
// next, the authentication
//putstringSS("Host: ");
//putstringSS_nl(IPADDR);
//putstring("Host: ");
//putstring_nl(IPADDR);
putstringSS_nl("Host:
api.supertweet.net");
putstring_nl("Host:
api.supertweet.net");
putstringSS("Authorization: Basic ");
putstring("Authorization: Basic ");
mySerial.println(linebuffer);
Serial.println(linebuffer);
putstringSS_nl("Content-Type: application/x-www-form-urlencoded");
putstring_nl("Content-Type: application/x-www-form-urlencoded");
putstringSS("Content-Length: ");
mySerial.println(7+strlen(tweet), DEC);
putstring("Content-Length: ");
Serial.println(7+strlen(tweet), DEC);
putstringSS("\nstatus=");
mySerial.println(tweet);
putstring("\nstatus=");
Serial.println(tweet);
"_nl" stands for "new line" I assume. however, the effect was that
every information is printed in it's own line like with a "println"
command. Mr. Blog posted code in this discussion which gave me the
idea:
http://groups.google.com/group/supertweet-myapi-proxy/browse_thread/thread/7bb927808380f93d/82d0c1d005ab9a14?hl=en&lnk=gst&q=botanicalls#82d0c1d005ab9a14
As a result I get this from the Arduino serial monitor:
Reset OK!
Read: 43Connected...
[secret]
POST /1/statuses/update.xml HTTP/1.1
Host:
api.supertweet.net
Authorization: Basic [secret]
Content-Type: application/x-www-form-urlencoded
Content-Length: 30
status=Current Moisture: 79%25
HTTP/1.1 200 OK
Date: Sun, 24 Oct 2010 21:05:24 GMT
Content-Type: text/xml; charset=ISO-8859-1
Date: Sun, 24 Oct 2010 21:05:25 GMT
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Accept-Ranges: bytes
Server: Restlet-Framework/2.0snapshot
Content-Length: 2204
The tweet is sent proper, everything works well. Supertweet is really
a nice peace of help – otherwise my Botanicall would be dead as I am
not able to write an OAuth-method in Arduino by myself.
I hope that this is going to help you a little...
Cheers
Meik
On Oct 24, 9:52 pm, Jacob Bockelmann <
bockelmann.ja...@gmail.com>
wrote:
> Interesting. That might be the key to my project. Can you post your
> code concerning the post function?
>
> Thanks,
> Jacob
>
> Sent from my iPhone
>