hey
i have password .httpaccess protected directory and I need to a access page in that directory. I know i can do that w/ cURL but i’m not sure how to use curl.
Can some one help me out?
Here is the code that i have so far, but I dont think it works ?
[code=php]
<?
echo “Running Access Function<br>”;
$url=”http://xxxxxxxx/xxxxxxxl.php”;
/* fetch the config */
$cm = curl_init();
/* FIX proxy usage: */
curl_setopt($cm, CURLOPT_PROXY, ”);
curl_setopt($cm, CURLOPT_URL, $url);
curl_setopt($cm, CURLOPT_USERPWD, “xxxxxxxxxx:xxxxxxxxxxxx”);
curl_setopt($cm, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
//curl_setopt($cm, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($cm, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($cm, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($cm, CURLOPT_POSTFIELDS, “Submit=Download configuration”);
curl_setopt($cm, CURLOPT_POST, true);
curl_setopt($cm, CURLOPT_VERBOSE, TRUE);
$res = curl_exec($cm);
/*if ($res == FALSE) {
//$this->error = curl_error($cm);
echo curl_error($cm);
curl_close($cm);
return 0;
} else {
$httpcode = curl_getinfo($cm, CURLINFO_HTTP_CODE);
curl_close($cm);
//$this->rawconfig = $res;
echo “cURL ok”;
return $httpcode;
}
*/
?>