Monday, April 20, 2009

Curl HTTP Authentication

// HTTP authentication
$url = "http://www.example.com/protected/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>



source(s): http://devzone.zend.com/article/1081-Using-cURL-and-libcurl-with-PHP

2 comments:

Anonymous said...

hello... hapi blogging... have a nice day! just visiting here....

suganthi ezhil vijith said...

i am visiting so nice