【发布时间】:2013-07-24 20:31:55
【问题描述】:
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:URL HIDDEN 然后返回消息 ID 或相应的错误代码。
但是我得到的输出超出了我的预期!甚至没有错误日志。请帮帮我:)
【问题讨论】:
-
CURLOPT_HEADER表示在结果中包含 HTTP 标头。 -
我删除了那行,它似乎有效。谢谢你:)