Phone Verification Code

Source: Internet
Author: User

PHP Access Apocalypse technology SMS SDK Interface: This method is placed in the controller, modified to their own serial number and password. Other methods call this method, you can send a verification code SMS to the phone.

 Public functionPOST_MT ($phone,$phone _code)    {        $flag= 0; //the data to post        $argv=Array(                 ' sn ' = ' aaaaaaaaaaaa ',////Replace with your own serial number' PWD ' =Strtoupper(MD5(' Aaaaaaaaaaaa '. BBBBBB ')),//Here the password requires encryption encryption method MD5 (Sn+password) 32-bit uppercase' Mobile ' = '$phone",//mobile phone number multiple comma-separated post theory with English there is no length limit. Recommended mass one time less than or equal to 10,000 mobile phone number' Content ' =Iconv("UTF-8", "Gb2312//ignore", "Hello, registration verification code for".$phone _code. ", this verification code is valid within 10 minutes. "),//SMS Content' ext ' = ' = ', ' stime ' and ', '//timing Time format is 2011-6-29 11:09:21' Rrid ' and ' = '                 ); //constructing a string to post        foreach($argv  as $key=$value) {                  if($flag!=0) {                                 $params. = "&"; $flag= 1; }                 $params.=$key." =";$params.=UrlEncode($value); $flag= 1; }         $length=strlen($params); //Create a socket connection         $fp=Fsockopen("sdk2.entinfo.cn", 8060,$errno,$errstr, ten) orExit($errstr." ---> ".$errno); //constructs the header of a POST request         $header= "POST/WEBSERVICE.ASMX/MT http/1.1\r\n"; $header. = "host:sdk2.entinfo.cn\r\n"; $header. = "content-type:application/x-www-form-urlencoded\r\n"; $header. = "Content-length:".$length." \ r \ n "; $header. = "connection:close\r\n\r\n"; //add a string for post         $header.=$params." \ r \ n "; //send data for post         fputs($fp,$header); $inheader= 1;  while(!feof($fp)) {                         $line=fgets($fp, 1024);//removal of the header of the request package shows only the return data of the page                         if($inheader&& ($line= = "\ n" | |$line= = "\ r \ n")) {                                 $inheader= 0; }                          if($inheader= = 0) {                                //echo $line;                          }          }          //<string xmlns= "http://tempuri.org/" >-5</string>           $line=Str_replace("<string xmlns=\" http://tempuri.org/\ ">", "",$line); $line=Str_replace("</string>", "",$line); $result=Explode("-",$line); //echo $line. " -------------";            if(Count($result) >1)            EchoThe ' Send failed return value is: '.$line.‘。 Please see the WebService return value comparison table '; Else            EchoThe ' send successful return value is: '.$line; }

Mobile Phone Verification Code

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.