Display user count from delicious

I m redesign one of my showcase site , one of the feature i m thinking of is display user count that saved the showcase site on delicious. Although there are some ready solutions call tagometer, but it seem like the options is limited, nothing much can be configure. This image tell why i need the the user count for [image via go2web2.0]

saved-on-delicious.jpg

after some research , i find out that for getting the total user , it  can be done in 4 line , if your host/server is having PHP 5.2 and above.

[php]$hash=md5($url);
$delrawoutput = file_get_contents("http://feeds.delicious.com/v2/json/urlinfo/$hash");
$deloutput = json_decode($delrawoutput, true);
echo $deloutput[0]["total_posts"];[/php]

what you actually need to do is convert the url into md5 hash and send over to delicious API , it will return json data and after json_decode ( function that available on php5.2 and greater ), you can get the total user count.

If you want to use this in your wordpress theme , just paste the below function in your theme folder , on a file call functions.php , after that you can just apply the function in your theme with provided url.

[php]function getDeliciousCount($url){
$hash=md5($url);
$delrawoutput = file_get_contents("http://feeds.delicious.com/v2/json/urlinfo/$hash");
$deloutput = json_decode($delrawoutput, true);
return $deloutput[0]["total_posts"];
}[/php]

You may also like...