APP, website and other registration, login, change and so on to send verification code SMS access process

Source: Internet
Author: User

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-&Gt;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.