duanluangua8850 2009-06-10 09:50
浏览 75
已采纳

在PHP中使用webservice返回XML

I am using a webservice to get some results in XMl form... here is the part of the code

public function getXML()
{
    $url=$this->constructURL();
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $xml = curl_exec($ch);
    if ($error = curl_error($ch)) {
    echo "Error: $error<br />
";
    }
    curl_close($ch);
    return $xml;
}


$resultXML = $api->getXML();
echo $resultXML;

when i echo that '$asd' it does nothing but a balnk page...

but when i use the value of $url directly in the browser it produce an XML result...

can any one suggest me where i am going wrong???

ADDED.........

when i included the error reporting after curl_exec

it gives an error

Error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

also Iam usig https://blahblh for request

  • 写回答

2条回答 默认 最新

  • douzha5990 2009-06-10 10:52
    关注

    Solved Out The PROBLEM....

    since i am using https:// ,i Have to include a single line of code which set the cURL options

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题