<?php
ini_set(‘max_execution_time’, 300); //300 seconds = 5 minutes
if($_REQUEST["screenid"])
{
$screenid=$_REQUEST["screenid"];
}
else
{
$screenid=”jaybharatjay”;
}
$follower_url = “http://api.twitter.com/1/statuses/followers/$screenid.xml”;
//$follower_url = “http://api.twitter.com/1/statuses/following/$screenid.xml”;
//$follower_url = “http://api.twitter.com/1/statuses/jaybharatjay/retweeted_by.xml”;
// exmaple $follower_url = “http://api.twitter.com/1/statuses/followers/w3cgallery.xml”; or
$follower_url = “http://api.twitter.com/1/statuses/followers/22250021.xml”;
$twFriends = curl_init();
curl_setopt($twFriends, CURLOPT_URL, $follower_url);
curl_setopt($twFriends, CURLOPT_RETURNTRANSFER, TRUE);
$twiFriends = curl_exec($twFriends);
$response = new SimpleXMLElement($twiFriends);
if($twiFriends)
{
print_r($response);
foreach($response->user as $friends){
$thumb = $friends->profile_image_url;
$url = $friends->screen_name;
$name = $friends->name;
?>
<?php /*?><a title=”<?php echo $name;?>” href=”http://www.twitter.com/<?php echo $url;?>”>
<img class=”photo-img” src=”<?php echo $thumb?>” border=”0″ alt=”" width=”40″ /></a><?php */?>
<a title=”<?php echo $name;?>” href=”<?php echo $_SERVER['PHP_SELF'].”?screenid=”.$url;?>”>
<img class=”photo-img” src=”<?php echo $thumb?>” border=”0″ alt=”" width=”40″ /></a>
<?php
}
}
else
{
echo “Data not coming from twitter api”;
}
?>