PHP code to intercept SMS content

Source: Internet
Author: User
This article mainly and everybody introduced the PHP interception launches the message content method, the need friend can refer to, hoped can help everybody.

The specific code looks like this:


 $str _tmp = dadmin_utils::gbkstrsplit ("message content", 700);//The content is too long to return an array after intercepting the content    700 refers to the length of the interception $total = count ($str _tmp);    $num = 1; foreach ($str _tmp as $str) {if ($total > 1) {$str = $str.       "{$num}/{$total}";      $num + +;      } $sign = Strtoupper (MD5 ($key. $pMobile. $str. $ip)); $url = "SMS address? from=37&sgin=". $sign. " &tel= ". $pMobile."      &msg= ". $str;      $ret = file_get_contents ($url);    $result = Json_decode ($ret, true);    }//Send SMS Method function Gbkstrsplit ($string, $len = 1) {$length = strlen ($string);//Get length, Chinese characters account for three bytes $retstr = ';    $RETARR = Array (); for ($i = 0; $i < $length; $i + +) {$retstr. = Ord ($string [$i]) > 127? $string [$i]. $string [+ + $i]: $string [$i      ];      $len _tmp = strlen ($RETSTR);        if ($len _tmp >= $len) {$RETARR [] = $RETSTR;      $retstr = ";    }} if ($retstr! = ") {$RETARR [] = $RETSTR;  } return $RETARR; }
Related Article

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.