我想通过使用diafaan sms网关从网络向手机发送消息。但是我无法使用他们的diafaan服务器api发送消息。错误是"没有收件人电话"。如果我替换为="我的电话号码",它已正确发送。我该怎么做?
$diafaan_user = "admin";
$diafaan_password = "";
$diafaan_url="http://localhost:9710/http/send-message?username=admin&password=&to=%2B44xxxxxxxx&message-type=sms.automatic&message=Message+Text";
function diafaanSend($phone_no, $activate_code, $debug=false){
global $diafaan_user,$diafaan_password,$diafaan_url;
$url.= 'username='.$diafaan_user;
$url.= '&password='.$diafaan_password;
$url.= '&action=sendmessage';
$url.= '&messagetype=sms.automatic';
$url.= '&recipient='.urlencode($phone_no);
$url.= '&message='.urlencode($activate_code);
$urltouse =$diafaan_url.$url;
if ($debug) { echo "Request: <br>$urltouse<br><br>"; }
echo $urltouse;
}
/*GET data from sendsms.html*/
$phone_no;
$activate_code;
diafaanSend($phone_no, $activate_code);
/*Insert into database*/
if ($phone_no!='') {
$sql = "INSERT INTO messageout (receiver,activate_code,status) ".
"VALUES ('$phone_no','$activate_code','send')";
$result = mysql_query($sql) or die("Query failed: ".mysql_error());
}
?>
答案 0 :(得分:0)
根据您的代码,您只需定义phone_no - IN
你必须从$ _GET params - $phone_no;
得到它,例如。