File Under: APIs

Delicious API

This PHP code will retrieve your thirty most recent posts from the bookmark sharing service del.icio.us. Replace your username and password where applicable to get your own result.


<?

$dusername = "XXXXXXXXXXXXX";

$dpassword = "XXXXXXXXXXXXX";

$api = "api.del.icio.us/v1";

$apicall = "https://$dusername:$dpassword@$api/posts/recent?&count=30";

function del_connect($url) {

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL,$url);

    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

    curl_setopt($ch, CURLOPT_USERAGENT, 'mycoolname');

    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

    $xml = curl_exec ($ch);

    curl_close ($ch);

    return $xml;

}

$result = del_connect($apicall);

echo $result;

?>