这是一个kannel服务:
group = sms-service
keyword-regex = "^regexhere[abc]"
get-url = "http://localhost/abc/sms/sendsms.php?sender=%p&name=%a"
我想从我的文件“sendsms.php”验证我的数据库中的名称,即%a,然后想要发送短信,但在用db验证名称后无法发送短信。这是我的代码:
$to=$_GET['sender'];
$username=$_GET['name'];
//verifying received username
if($getusername = mysql_fetch_array(mysql_query("SELECT count(*) as count FROM tablename where username ='".$username."'", $DB))) {
if ($getusername['count']==0) {
header("Location: http://localhost:13013/cgi-bin/sendsms?username=kanneluser&password=foo&to=".$to."&text=Wrong User name, Please SMS valid user name!");
}
else {
header("Location: http://localhost:13013/cgi-bin/sendsms?username=kanneluser&password=foo&to=".$to."&text=text here!");
}
}
我是否以真实的方式调用了URL? 非常感谢您的帮助!
答案 0 :(得分:1)
要通过get-url进行自动重播,只需在if循环中使用echo,无需调用kannel的send url api。
if ($getusername['count']==0) {
echo "Wrong User name, Please SMS valid user name!";
}
else {
"text=text here!";
}