我打了一个 curl 电话,似乎很顺利。
[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);
怎么会?