我需要从https网站获取信息,它有http身份验证,我做了一些研究,我知道我需要使用curl所以我的代码是
$ch = curl_init();
$url = 'https:/....';
$username ='user';
$password ='userspassword';
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_SSLKEYTYPE,"PEM");
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSLCERT, '/var/www/cert/ows.pem');
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, ' ');
curl_setopt($ch, CURLOPT_SSLKEY, '/var/www/cert/ssl-cert-snakeoil.pem');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, ' ');
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSLVERSION,3)
并且我得到“无法设置私钥文件:'/ var / www / cert / ssl-cert-snakeoil.pem'类型PEM58”如果我不使用任何pem我从服务器获得空响应,如果我这样做无法加载它们...我可以在我的系统上找到sslcert和sslkey吗?以及如何正确地格式化它们,因为如果我直接从firefox导出它们。