Google Ad

Showing posts with label delicious. Show all posts
Showing posts with label delicious. Show all posts

Saturday, July 14, 2007

Using PHP curl to fetch post from del.icio.us

Been playing with del.icio.us's api to pull my del.icio.us ( very hard writing that ) post. php's curl made everything smooth. Below is the code. Feel free to comment on it.

$fetch_url ="https://api.del.icio.us/v1/posts/all?";
$curl = curl_init();
curl_setopt( $curl, CURLOPT_URL, $fetch_url );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curl, CURLOPT_USERPWD,"your username:your password");
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 30 );
curl_setopt( $curl, CURLOPT_TIMEOUT,5 );
curl_setopt( $curl, CURLOPT_POST, 1 );
$response = curl_exec( $curl );
curl_close( $curl );
header("Content-Type:text/xml");
echo $response;