Archive for February, 2009

I’m one of the unlucky people living in far-away places that don’t get Twitter updates via SMS. Recently, Twitter activity has increased among some of my friends, so I wanted to get updates without having to remember to visit the site (I’m lazy that way).

Long story short, the “friends_timeline” RSS feed that twitter offers is password protected, whereas Google Reader doesn’t support passwords (and even if it did, I wouldn’t want to put my Twitter password there). So my idea was to create a non-password protected proxy page that takes care of entering the password and returning the contents of the feed. Below is a simple PHP script that does just that. You can put it on your web server and subscribe to it using your choice of RSS reader, no passwords required.

// A simple proxy to fetch password-protected pages on services that don't
// support it. Example: twitter feed on google reader
// based on:
// http://developer.yahoo.com/javascript/samples/proxy/php_proxy_simple.txt
// Author: Jason Levitt
// December 7th, 2005
// Modifications: Ehud Meiri, Feb 2009

$url = 'http://USERNAME:PASSWORD@twitter.com/statuses/friends_timeline/NUMBER.rss';

// Open the Curl session
$session = curl_init($url);

// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

// Make the call
$xml = curl_exec($session);

echo $xml;


To use it for your account, change the “$url” line to match your details (you can find your NUMBER in the “RSS feed” link here).

Note that this solution is insecure (esp. on shared machines), as the password is stored in plaintext in the script and anybody who can read the script source can know your password. Be careful.

Read Full Post »