我试图将带有身份验证标头的curl语句转换为php curl请求.
但它似乎没有工作,因为我收到了错误回应’错误:’. curl_error($CH);:
error:SSL certificate problem: unable to get local issuer certificate
我的curl-command看起来像这样:
curl --user XXXX:YYYY "URL"
我的php-curl看起来像这样:
$login = 'XXXX';
$password = 'YYYY';
$url = 'URL';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
echo curl_exec($ch);
$result = curl_exec($ch);
if ($result != false){
echo "SUCCESS";
}else{
echo "
";
echo 'error:' . curl_error($ch);
echo "
";
}
curl_close($ch);
echo($result);
有人看到我的错吗?