1. Login https://zz.253.com/site/login.html
2. Get interface API account, password: Select any product > Activation > Enterprise certification (upload company business license)
3. Application for signature (named by company abbreviation or abbreviation) Note: Platform application signature, API interface plus request for signature
4. Template request (custom edits): Select any app > short-term edit Section {Template Management}> add signature
4.sms_send_demo.php Send SMS
sms_querybalance_demo.php Query SMS Balance
Note: Application template can be used to avoid the role of SMS
Problems
1. The same number has 10 restrictions per day (can be adjusted according to business requirements)
2. Interface account (using API account, password is not login admin background account, password)
Status Report access process:
1. Configure an extranet to access the URL to accept the asynchronous push of the blue server
2. Reference receive.php
Main code:
<?php
Header ("content-type:text/html; Charset=utf-8 ");
Class Chuanglansmsapi {
Send SMS Interface Address const api_send_url= ' http://sms.253.com/msg/send? '; Query the balance of the interface address const api_balance_query_url= ' http://sms.253.com/msg/balance? '; Const api_account= ' ******* ';//SMS account is obtained from https://zz.253.com/site/login.html. Const api_password= ' ******* ';//SMS password is obtained from https://zz.253.com/site/login.html. /** * Interface parameters required to send SMS * * @param string $mobile phone number * @param string $msg The text message you want to send * @param string $needstatus Whether the status report required ' 1 ' is required for ' 0 ' bit. */Public Function sendsms ($mobile, $msg, $needstatus = 1) {//interface parameter for sending SMS $POSTARR = Array ( ' UN ' = self::api_account, ' pw ' = self::api_p Assword, ' msg ' = $msg, ' phone ' and ' = ' $mobile , ' rd ' = $needstatus); $result = $this-≫curlpost (Self::api_send_url, $POSTARR); return $result; }/** * * * Query Balance * * Public Function querybalance () {//query interface parameter $POSTARR = AR Ray (' un ' = self::api_account, ' pw ' = Self::api_password,) ; $result = $this->curlpost (self::api_balance_query_url, $POSTARR); return $result; /** * * * * Processing interface return value * */Public Function Execresult ($result) {$result =preg_split ("/[,\r\n]/", $re Sult); return $result; }/** * @param string $url * @param array $postFields * @return mixed */Private function Curlpos T ($url, $postFields) {$postFields = Http_build_query ($postFields); if (function_exists (' Curl_init ')) {$ch = Curl_init (); curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_header, 0); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_postfields, $postFields); $result = curl_exec ($ch); if (Curl_errno ($ch)) {return ' Curl Error: '. Curl_error ($ch); } curl_close ($ch); }elseif (function_exists (' file_get_contents ')) {$result =file_get_contents ($url. $postFields); } return $result; }//Magic get Public Function __get ($name) {return $this, $name; }//Magic set Public Function __set ($name, $value) {$this, $name = $value; }
}
?>
APP, website and other registration, login, change and so on to send verification code SMS access process