什么是错在php code?未知输出 [英] What's wrong in the php code? Unknown output

查看:174
本文介绍了什么是错在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);

这篇关于什么是错在php code?未知输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆