PHP SMS interface basically solves the garbled problem of SMS interface.
Release: 2016-07-25 09:07:51
Original
1789 people have browsed it
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
|
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31