Featured Posts

Five Wordpress Plugins you SHOULD be using and probably... It's been a while since I shared a couple of Wordpress Plugins with you. In fact, my Last Post on the subject is almost a year old at this point (ok, its 11 months today)....

Readmore

GoogleWave a second Opinion So back in October I posted about my first impressions with google wave. I mentioned in there I was a little depressed by the number of people I had available to converse...

Readmore

How can twitter help my website? Lots. As a comment on my post about Twitter Wit, someone queried "How can Twitter help my website?" A good question, I thought, and one that I felt needed more then just a reply...

Readmore

WiiView: Pirates Hunt for Blackbeards Treasure! While the wii is out visiting the repair shop (no word yet on when its due back) I thought I'd go ahead and do something I've been meaning to do for a while... Review some...

Readmore

SugarSync Redux So somewhere around two weeks ago, I talked about SugarSync. I was pretty impressed with it and the ability to share documents between my desktop, laptop and blackberry...

Readmore

Delusions of Grandeur Rss

Auto Posting to Twitter

Posted on : 05-11-2008 | By : mcangeli | In : Techcrunch |

0

Google Buzz 

twitterberry1 Twitter is everywhere. Its on my phone, its on my laptop. It helped decide the election (don’t believe me, go search twitter for election, obama, biden, mccain, palin, vote or anything else to do with the election this year). It helped people find gas in Atlanta when we had a shortage. Now, its helping get the word out about the latest uploads to Linuxtracker.org.

Yesterday, I managed to cobble together some code (from some that I found online) that automatically posts to the linuxtracker twitter account *EVERY* time a new torrent is uploaded. It posts the name of the file as well as a link to the torrent details page. Its a pretty simple piece of code that actually uses the php_curl library to do the heavy lifting. The part I stumbled with was getting it to post the whole damned URL. Luckily I stumbled upon it.

I’ve posted the code below for anyone to use, mind you, I changed the names to protect the innocent, and I won’t answer any questions about it. I just wanted to share!

//Twitter Update!

$email = “USERNAME”;
$password = “PASSWORD”;
$status = “This is the status message here. Duh.
“;

$url = “http://twitter.com/statuses/update.xml”;

$session = curl_init();
curl_setopt ( $session, CURLOPT_URL, $url );
curl_setopt ( $session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt ( $session, CURLOPT_HEADER, false );
curl_setopt ( $session, CURLOPT_USERPWD, $email . “:” . $password );
curl_setopt ( $session, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $session, CURLOPT_POST, 1);
curl_setopt ( $session, CURLOPT_POSTFIELDS,”status=” . urlencode($status));
$result = curl_exec ( $session );
curl_close( $session );

?>

Blog Widget by LinkWithin

Popularity: 1% [?]

  • Share/Bookmark

Comments are closed.

Additional comments powered by BackType