Created
June 27, 2011 16:38
-
-
Save thiagosf/1049237 to your computer and use it in GitHub Desktop.
Funçoes para resgatar dados do Delicious
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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