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