doumie6223 2013-08-05 13:04
浏览 917
已采纳

curl_exec返回空白,没有错误

I make a curl call which seems to go fine.

[http_code] => 200, and curl_errno is 0.

Yet despite the fact there should be an output ([download_content_length] => 102), the curl_exec call doesn't return anything.

define('_WSURL', 'https://mobistar.msgsend.com/mmp/cp3'); // Feel free to try it yourself

$stderr = fopen("err.log", 'w+');
if ($stderr !== false) {
  print "Opened the log file without errors";
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, _WSURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');
// curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $stderr);
// curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).DIRECTORY_SEPERATOR.'c00kie.txt'); 

$data = curl_exec($ch);

fclose($stderr);

print_r(curl_getinfo($ch));

print_r($data);

if ($data === false)
{ // Process curl error codes here
    echo('ERROR');
    echo(curl_errno($ch));
} else {
    echo(sprintf('DATA: [%s]', $data));
}
curl_close($ch);

How comes?

  • 写回答

2条回答 默认 最新

  • douliao7930 2013-08-05 13:56
    关注

    Returns a response for me.

    <?xml version="1.0" encoding="UTF-8"?>
    <response code="499" description="The XML Content is Invalid"/>
    

    I suspect you're seeing a blank page in your browser. If it's so, take a look at the page source in the browser, the XML should be there.

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

报告相同问题?

悬赏问题

  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站