Retrieving a protected page with cURL : curl_setopt « Utility Function « PHP






Retrieving a protected page with cURL

 
<?php
$c = curl_init('http://www.example.com/secrets.php');
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_USERPWD, 'david:hax0r');
$page = curl_exec($c);
curl_close($c);
?>
  
  








Related examples in the same category