Ejemplo n.º 1
0
function extract_items($site, $content)
{
    switch ($site) {
        case 'flickr':
            //ok
            $items = get_flickr($content);
            break;
        case 'ffffound':
            //ok
            $items = get_ffffound($content);
            break;
        case 'dribbble':
            //ok
            $items = get_dribbble($content);
            break;
        case 'imgur':
            //ok
            $items = get_imgur($content);
            break;
        case 'picplz':
            //ok
            $items = get_picplz($content);
            break;
        case 'instagram':
            //ok
            $items = get_instagram($content);
            break;
        case 'delicious':
            //ok
            $items = get_delicious($content);
            break;
        case 'hn':
            //ok
            $items = get_delicious($content);
            break;
        case 'reddit':
            //ok
            $items = get_delicious($content);
            break;
        case 'pinboard':
            //ok
            $items = get_pinboard($content);
            break;
        case 'digg':
            //ok
            $items = get_digg($content);
            break;
        case 'youtube':
            //ok
            $items = get_youtube($content);
            break;
        case 'hulu':
            //ok
            $items = get_hulu($content);
            break;
        case 'yahoovideos':
            //ok
            $items = get_yahoovideos($content);
            break;
        case 'yahoobuzz':
            //ok
            $items = get_yahoobuzz($content);
            break;
        case 'googletrends':
            //ok
            $items = get_googletrends($content);
            break;
        case 'amazon':
            //ok
            $items = get_amazon($content);
            break;
        case 'itunes':
            //ok
            $items = get_itunes($content);
            break;
        case 'wearehunted':
            //ok
            $items = get_wearehunted($content);
            break;
        case 'twitter':
            //ok
            $items = get_twitter($content);
            break;
        case 'wordpress':
            //ok
            $items = get_delicious($content);
            break;
    }
    return $items;
}
Ejemplo n.º 2
0
        $url = 'https://api.del.icio.us/v1/posts/get?tag=twitter';
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        // add delicious.com username and password below
        curl_setopt($ch, CURLOPT_USERPWD, 'tungathurthi.chandu@yahoo.com:CoreJava');
        $data = curl_exec($ch);
        curl_close($ch);
        $cachefile = fopen($cache, 'wb');
        fwrite($cachefile, $data);
        fclose($cachefile);
    } else {
        $data = file_get_contents($cache);
    }
    $xml = simplexml_load_string($data);
    $html = '<ul>';
    foreach ($xml as $item) {
        $html .= '<li><a href="' . $item['href'] . '">' . $item['description'] . '</a> ' . $item['extended'] . '</li>';
    }
    $html .= '<li><a href="http://delicious.com/briancray">More of Brian Cray\'s delicious bookmarks&hellip;</a></li>';
    $html .= '</ul>';
    echo $html;
}
// display them
get_delicious();