【发布时间】:2011-09-30 03:38:42
【问题描述】:
我的任务是从https://test24.highrisehq.com/tasks/upcoming.xml 检索一个安全连接并要求身份验证的 xml。我正在尝试使用 curl 来实现这一点,但我不知道为什么用户名和密码对我不起作用。这是我的代码:
$url = "https://test24.highrisehq.com/tasks/upcoming.xml";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_USERPWD, "omayrakhtar@gmail.com:akhtar1234");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,true);
curl_setopt($ch, CURLOPT_CAINFO, "D:\wamp\www\xml\-.highrisehq");
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
print_r($result);
问题是,当我将VERIFYPEER 设置为true 时,浏览器上什么也没有显示,而当它设置为false 时,我得到 HTTP Basic: Access denied。 curl 和 openssl 都已启用。代码中的凭据是正确的,如果有人想使用它,他非常受欢迎。我们将不胜感激。
问候
乌梅尔
【问题讨论】:
标签: php authentication curl https openssl