- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
- number_format: documentation ( source)
<?php
$fb_username = 'LinkToLife';
$tw_username = 'phishnet';
$fb = @json_decode(file_get_contents('https://graph.facebook.com/'.$fb_username));
$fb_fans = number_format($fb->fan_count);
$tw = @json_decode(file_get_contents('http://api.twitter.com/1/users/show.json?screen_name='.$tw_username));
$tw_followers = number_format($tw->followers_count);
?><html>
<head>
<title>Fans and Followers</title>
</head>
<body>
Facebook fan count: <?=$fb_fans;?><br />
Twitter follower count: <?=$tw_followers;?><br />
</body>
</html>