我一直在使用一个带有curl的脚本,它运行得很好,但从上一天起就不起作用了,我发现我使用这个脚本的网站最初是http,现在变成了https,所以我把http改成了https但没有成功,所以如果你们能检查一下这个代码,它出了什么问题?
$userSearch = array();
$loginURL = "https://www.infamousgangsters.com/checkuser.php";
$referer = "https://www.infamousgangsters.com/index.php";
$agent = "OrgyBot (Checking list of users to see if they are dead)";
$postFields = array
(
"username" => "d34dch3ck",
"password" => "d34dch3ck93",
"sublogin" => "+Login+"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookiejar');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookiejar');
ob_start();
$output = curl_exec($ch);
ob_end_clean();
curl_close($ch);
unset($ch);
echo $output;
https使用curl并不是那么简单。您需要将其配置为接受证书。点击此处阅读更多信息:http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/