Code covered by the BSD License  

Highlights from
Update twitter status

4.66667

4.7 | 3 ratings Rate this file 9 Downloads (last 30 days) File Size: 4.99 KB File ID: #20290

Update twitter status

by Navan Ruthramoorthy

 

13 Jun 2008 (Updated 17 Dec 2010)

Update your Twitter® status from MATLAB®

| Watch this File

File Information
Description

Using a MATLAB function update your status in Twitter.

Acknowledgements
This submission has inspired the following:
twitty
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
04 Jun 2009 Michael Katz

Fun submission. You should check out http://www.mathworks.com/matlabcentral/fileexchange/6590 to get a password field for the user info GUI.

20 Oct 2010 Matt Easton

This worked really well until Twitter changed their posting system. It now gives a response saying basic authentication is not accepted.

20 Oct 2010 Navan Ruthramoorthy

Hi Matt, I am working on an update for the authentication method.

21 Nov 2010 Michael Antaran

I look forward to the update.

08 Dec 2010 Navan Ruthramoorthy

I have updated the script with OAuth support. The user needs to do a one time registration of the function as an application at twitter.com to get OAuth keys. The details are provided as part of help in the script. It is easy to use the function once you obtain the keys.

09 Dec 2010 Sounay Phothisane  
14 Dec 2010 Matthew Simoneau

Implementing OAuth in MATLAB. Very nice!

16 Dec 2010 Michael Antaran

Navan-
I've had a difficult time with the twitpref function.

I recieve an error referncing the base64... Here it is:

??? Undefined variable "Base64" or class "Base64.encodeBase64".

Error in ==> twit>doHMAC_SHA1 at 160
    signStr = java.lang.String(Base64.encodeBase64(mac.doFinal(bytes)));

Error in ==> twit at 99
oauth_signature = doHMAC_SHA1(signStr, signKey);

I understnad what it says but do not know how to fix it. I am using 2007b (32 and 64bit).
Please help.

16 Dec 2010 Menachem

Hello, I just downloaded your program and got the same error as michael. I dont know if I am using your program correctly. I entered my twitter info and msg as strings.

thanks

??? Undefined variable "Base64" or class "Base64.encodeBase64".

Error in ==> twit>doHMAC_SHA1 at 160
    signStr = java.lang.String(Base64.encodeBase64(mac.doFinal(bytes)));

Error in ==> twit at 99
oauth_signature = doHMAC_SHA1(signStr, signKey);

17 Dec 2010 Navan Ruthramoorthy

Michael and Menachem,
Sorry I did not check the code in R2007b after the update. Apache commons package is not available in R2007b. To make it work in R2007b you need to do the following.

1. Download the Apache commons codec binaries from http://commons.apache.org/codec/download_codec.cgi.
2. After you extract the binaries add the jar file to the java path using
javaaddpath('<pathtofile>/commons-codec-1.4.jar'). Replace <pathtofile> with the directory where you extracted the files.
3. In twit.m replace the line:114 which currently is
114: outputStream.write(java.lang.String(msgEncodedStrforPost).getBytes());

with the following two lines.

msgEncodedStrforPostString = java.lang.String(msgEncodedStrforPost);
outputStream.write(msgEncodedStrforPostString.getBytes());

After this it should work. Let me know if this helps.

From R2008a the Apache commans libraries are available and the code works without any changes.

19 Oct 2011 Shien Kwun Leong

Very useful! Thank you very much.

Please login to add a comment or rating.
Updates
09 Nov 2010

Updated script to make it work with OAuth.

03 Dec 2010

Updated script to support OAuth.

17 Dec 2010

Changed MATLAB release needed.

Tag Activity for this File
Tag Applied By Date/Time
twitter Navan Ruthramoorthy 22 Oct 2008 10:06:00
update Navan Ruthramoorthy 22 Oct 2008 10:06:00
status Navan Ruthramoorthy 22 Oct 2008 10:06:00
matlab Navan Ruthramoorthy 22 Oct 2008 10:06:00
utilities Navan Ruthramoorthy 22 Oct 2008 10:06:00

Contact us at files@mathworks.com