- I have a site www.abc.domain.com protected with .htaccess & .htpasswd.
- I have file a callback.php file that need to access www.abc.domain.com and check for data. This file is in other server, other domain.
- I use curl to request.
I see CURLOPT_USERPWD can be used for access protected folder. But in my callback.php file, it doesnt have CURLOPT_USERPWD. How do I modify my file, add CURLOPT_USERPWD to make it works?
You can see my file here:
<?php
function callback_start() {
$yoururl = "http://abc.domain.com";
include "key.php";
$pass_array['key'] = $key;
$pass_array['domain'] = $_SERVER['SERVER_NAME'];
function confirm($url, $data) {
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => false, CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 50, CURLOPT_TIMEOUT => 50, CURLOPT_MAXREDIRS => 0,
CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $data, CURLOPT_SSL_VERIFYHOST => 0, );
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
$info = confirm($yoururl . "/folder/index.php", $pass_array);
if ($info['status'] == "2") {
return die("Suspended!");
}elseif($info['status'] == "3") {
return die("Incorrect");
}elseif($info['status'] != "1") {
return die("Error!");
}
}
?>