Retrieving a password protected page with cURL

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

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.