Google Ad

Saturday, July 14, 2007

Using PHP curl to fetch post from

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

$fetch_url ="";
$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 );
echo $response;


adamjmcgrath said...


That's exactly what I was after... Many thanks


Jamie R said...

Does this still work for you? I had the code working on php 5.2.3, but with 5.2.5 it is not working anymore. It seems I had to take out the line about the CURLOPT_POST. I'm not in charge of the server, so wondering if it is a typical problem in 5.2.5 or our admin goofed it up.

viagra online said...

I would like to learn how to use PHP, so I think that it is the best way to program, so I feel so happy when someone share this kind of information because I can learn something new.

ppt template said...

A study has been very good. so that we can make delicious telling the sending of data.