Revision: 17327
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 1, 2009 08:02 by neal_grosskopf
Initial Code
function curl($url)
{
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_USERAGENT,"www.YOURDOMAIN.com");
curl_setopt($ch,CURLOPT_TIMEOUT,10);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function GetTwitterFollowerCount($username)
{
$twitter_followers = curl("http://twitter.com/statuses/user_timeline/".$username.".xml?count=1");
$xml = new SimpleXmlElement($twitter_followers, LIBXML_NOCDATA);
return = $xml->status->user->followers_count;
}
echo GetTwitterFollowerCount("YourTwitterName");
Initial URL
http://www.nealgrosskopf.com/tech/thread.php?pid=57
Initial Description
Display the number of people following you on Twitter using this custom Twitter badge. The code simply returns a number so you can style it however you like.
Initial Title
Custom Twitter Badge Using PHP
Initial Tags
php, twitter
Initial Language
PHP