Skip to content

Instantly share code, notes, and snippets.

@lslucas
Forked from thiagosf/delicious.php
Created June 27, 2011 17:29
Show Gist options
  • Save lslucas/1049329 to your computer and use it in GitHub Desktop.
Save lslucas/1049329 to your computer and use it in GitHub Desktop.
Funçoes para resgatar dados do Delicious
<?php
// Mais informações
// http://www.delicious.com/help/feeds
// Count
function delicious_count($url) {
$count = 0;
$jsonurl = "http://feeds.delicious.com/v2/json/urlinfo/" . md5($url);
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, true);
if (!empty($json_output)) {
$del_count = $json_output[0]['total_posts'];
$del['count'] = $del_count;
$del['lastcheck'] = mktime();
$del = serialize($del);
$count = ($del_count == null) ? 0 : $del_count;
}
return $count;
}
// Bookmarks for a specific user by tag(s):
function delicious_bookmarks ($user, $tag = null) {
$jsonurl = 'http://feeds.delicious.com/v2/json/'.$user.'/'.$tag;
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, true);
if (!empty($json_output)) {
return $json_output;
}
}
// Popular bookmarks by tag:
function delicious_popular ($tag = null) {
$jsonurl = 'http://feeds.delicious.com/v2/json/popular/'.$tag;
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, true);
if (!empty($json_output)) {
return $json_output;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment