什么是错在php code?未知输出

问题描述:

PHP code文件:sms1.php
位于 http://techmentry.com/sms1.php (请访问链接,看到的outpur下面code)。

PHP code file: sms1.php Located at http://techmentry.com/sms1.php (please visit the link and see the outpur of the below code).

<?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"
?>

我期望的输出是:以上code应该有这样的过程网址:网址HIDDEN
然后返回一个消息ID或appropiate错误code。

The output I expected is: The above code should have process this URL: URL HIDDEN and then return a message ID or appropiate error code.

但我得到的输出是超出了我的厚望!甚至有没有错误日志。请帮我:)

But the output I got is beyond my expection! There are even no error logs. Please help me :)

您得到code,但你也得到来自服务器的完全缓解,包括HTTP标头。

You get the code, but you also get the complete response from the server, including HTTP headers.

我得到:

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