【发布时间】:2013-07-23 23:36:47
【问题描述】:
文件名:sms1.php 位于:http://techmentry.com/sms1.php
sms1.php的PHP代码:
<?php
//Variables to POST
$user = "hidden";
$password = "hidden";
$mobiles = "$_POST[phone]";
$message = "$_POST[msg]";
$sender = "$_POST[sender]";
//Initialize CURL data to send via POST to the API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.hidden/sendhttp.php");
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";
?>
<br><br><br>
<form name='sms' action='' method='post'>
Phone number<br/><input type='text' name='phone' value='' maxlength=12/>
<br/>
Sender ID (from) <br/><input type='text' name='sender' value='' maxlength=15/>
<br/>
Message : <br/><textarea rows=5 cols=30 name='msg'></textarea>
<br/>
<input type='submit' value='Send'>
</form>
请查看http://techmentry.com/sms1.php 上的输出。它已经显示错误代码(105)(已经 - 因为它应该在用户单击发送按钮时显示错误代码)。 105 错误代码表示缺少“密码”参数。但是我已经在代码中说明了密码。
请帮忙:)
【问题讨论】:
-
一方面,您的
$mobiles = "$_POST[phone]";应读作$mobiles = $_POST['phone'];(减去双引号)并在括号内使用单引号。对其他人做同样的事情,试试看。 -
@Fred 至少告诉他正确的语法...
$mobiles = $_POST['phone']; -
@Rufinus 哎呀!!!如此真实。很好,将编辑,谢谢。 (我正在喝第一杯咖啡),那位女服务员呢?女服务员?!请加一份美式咖啡加一杯浓缩咖啡。
-
@user2604855 告诉我你什么时候修复它,这样我就可以使用你的脚本通过你的脚本发送我所有的短信,并为我节省一些钱。 :)
-
我在 $mobiles = $_POST[phone] 中添加了 ';现在它的 $mobiles = $_POST['phone'];现在出现错误:解析错误:语法错误,意外的 T_ENCAPSED_AND_WHITESPACE,在第 6 行的 /home/ash/public_html/sms1.php 中期待 T_STRING 或 T_VARIABLE 或 T_NUM_STRING 当我删除 ' 时,错误也会消失!请帮忙