价格不是我们的优势,品质永远是我们的追求!
当前位置:首页行业快讯 > php短信接口文档—乐信短信接口
php短信接口文档—乐信短信接口
来源:动力思维乐信  时间:2016-05-19 10:54

  乐信作为行业的佼佼者,拥有12年的短信行业运营经验,其接口方便调用,响应速度快、稳定,下面为大家分享下乐信php短信接口文档供大家参考:

 

<?php

 

require_once 'HttpClient.class.php';

class dlswSdk {

           const HOST = 'www.lx198.com';

           final private static function __replyResult($xmlStr) {

                        $doc = new DOMDocument ();

                        $doc->loadXML ( $xmlStr );

                        print($xmlStr);

                        $xpath = new DOMXpath ( $doc );

                        $arr = $xpath->query ( '/reply/ErrorCode/text()', $doc );

                        $ret = '';

                        foreach ( $arr as $o ) {

                                 $ret = $o->nodeValue;

                        }

                        return $ret;

}

final public static function sendSms($user, $password,$content,$mobiles) {

              $client = new HttpClient ( self::HOST );

              $client->setDebug ( true );

              if (! $client->post ( '/sdk/send', array (

                                          ' accName' => $user,

                                          'accPwd' => strtoupper ( md5 ( $password ) ),

                                          'bizId' => date ( 'YmdHis' ),

                                          'content' => mb_convert_encoding ( $content, 'UTF-8', 'UTF-8' ),

                                          'aimcodes' =>$mobiles ,

                                          'dataType'=>"xml"

              ) )) {

                     return '-10000';

             } else {

                        return self::__replyResult ( $client->getContent () );

              }

          }

}

 

print(dlswSdk::sendSms( 'yangchao_713@163.com', '123456','下午好php【杨超】','13592605881'));

 

?>
全部php短信接口文档,请点击:php短信接口文档 下载。