continuity the portfolio and blog of william schurman201.754.8267
william@wschurman.com

Last.fm & Twitter

New addition to the ub_swiss WordPress template.

Last.fm uses the fmtuner plugin.

Twitter uses the following code…


<?php
function twitter_status($twitter_id, $hyperlinks = true) {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$src = curl_exec($c);
curl_close($c);
preg_match('/(.*)<\/text>/', $src, $m);
$status = htmlentities($m[1]);
if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "\\0", $status);
return($status);
}
?>

Insert both into the header.php template file.

Reply