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 );?>
| 3.2 |



mcangeli













Hot Talk
Gruntled
mcangeli, Gruntled
Armen Shirvanian
Gruntled
witchypoo