The PHP SMS interface basically solves the problem of garbled characters when PHP calls the SMS interface. The code is not complicated, but it is still practical.
The following SMS interface supports long text messages and replies. Here, I only share the sending function. Friends in need can refer to 56 SMS Network
The website is: http://www.56dxw.com and the speed is pretty good.
- sms.php file
- session_start();
- error_reporting(0);
- header("content-type:text ml;charset=gb2312");
- //Account configuration file
- $ comid= "60"; //Enterprise ID
- $username= "test1"; //Username
- $userpwd= "qwqwqw"; //Password
- $smsnumber= "1061"; //Platform used
- function rstr($str){
-
- if($str==1)
- $error='Represents successful sending';
- else{
- switch($str){
- case -1:$error='Mobile phone number is incorrect' ;break;
- case -2:$error='Except time, all parameters cannot be empty';break;
- case -3:$error='Username and password are incorrect';break;
- case -4:$error ='The platform does not exist';break;
- case -5:$error='The number of customer SMS messages is 0';break;
- case -6:$error='The customer account balance is less than the number of messages to be sent';break;
- case -8:$error='Illegal text message content';break;
- case -9:$error='Unknown system failure';break;
- case -10:$error='Network error';break;
- default: $error='Unknown error';
- }
- }
- print($error);
- exit();
- }
- function sendnote($mobtel,$msg){
- global $username,$userpwd,$smsnumber, $comid;
- $url = "http://jiekou.56dxw.com/sms/HttpInterface.aspx?comid=$comid&username=$username&userpwd=$userpwd&handtel=$mobtel&sendcontent=$msg&sendtime=&smsnumber=$smsnumber";
- $string = file_get_contents($url);
- return rstr($string);
- }
- $_SESSION["code"]="12365";
- $handtel =$_POST["Tel"];
- $msg="Mobile phone verification code Is: ".$_SESSION["code"];
- !$handtel && die('Mobile phone number required');
- !$msg && die('Occurrence content required');
- echo sendnote($_POST[ "Tel"],urlencode($msg));
- ?>
Copy code
|