Skip to content

Instantly share code, notes, and snippets.

@lslucas
Forked from thiagosf/delicious.php
Created June 27, 2011 17:29
Show Gist options
  • Select an option

  • Save lslucas/1049329 to your computer and use it in GitHub Desktop.

Select an option

Save lslucas/1049329 to your computer and use it in GitHub Desktop.

Revisions

  1. @thiagosf thiagosf created this gist Jun 27, 2011.
    75 changes: 75 additions & 0 deletions delicious.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    <?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;

    }

    }

    ?>