How can I send message to phone by using diafaan sms gateway with php -
i want send message web phone using diafaan sms gateway .but cann't send message using diafaan server api.the error "no recipient phone".if substitute to="my phone number",it correctly sent.how can that?
$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 sendsms.html*/ $phone_no; $activate_code; diafaansend($phone_no, $activate_code); /*insert database*/ if ($phone_no!='') { $sql = "insert messageout (receiver,activate_code,status) ". "values ('$phone_no','$activate_code','send')"; $result = mysql_query($sql) or die("query failed: ".mysql_error()); } ?>
by code define phone_no - $phone_no;
must $_get params - $phone_no = $_get['phone_no'];
, example.
Comments
Post a Comment