Skip to content

Instantly share code, notes, and snippets.

@thiagosf
Created June 27, 2011 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thiagosf/1049237 to your computer and use it in GitHub Desktop.
Save thiagosf/1049237 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