什么';php代码有错吗?未知输出


What's wrong in the php code? Unknown output

PHP代码文件:sms1.PHP位于http://techmentry.com/sms1.php(请访问链接并查看下面代码的输出)。

<?php
//Variables to POST
$user = "HIDDEN";
$password = "HIDDEN";
$mobiles = "919999999999";
$message = "test";
$sender = "HIDDEN";
//Initialize CURL data to send via POST
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://example.com/example.php");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&
password=$password&
mobiles=$mobiles&
message=$message&
sender=$sender"
);
//Execute CURL command and return into variable $result
$result = curl_exec($ch);
//Do stuff
echo "$result"
?>

我期望的输出是:上面的代码应该已经处理了这个URL:URLHIDDEN然后返回消息ID或相应的错误代码。

但是我得到的结果超出了我的预期!甚至没有错误日志。请帮助我:)

您可以获得代码,但也可以从服务器获得完整的响应,包括HTTP头。

我得到:

HTTP/1.1 200 OK
Date: Wed, 24 Jul 2013 12:24:01 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: max-age=60, private, proxy-revalidate
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 8
Content-Type: text/html
Set-Cookie: PHPSESSID=c9bfcf7ddd3fff9d0a05b34541fbf0a9; expires=Wed, 24-Jul-2013 16:24:01 GMT; path=/
code 105

尝试删除此行:

curl_setopt($ch, CURLOPT_HEADER, 1);