我做了一个似乎很好的卷曲调用。curl_exec返回空白,没有错误
[http_code] => 200
和curl_errno
为0
然而,尽管事实上应该有一个输出([download_content_length] => 102
)时,curl_exec调用不返回任何东西。
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);
怎么回事?
你试图访问什么网址? – ciruvan
一个web服务的响应。 – Serge