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条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?