1. 程式人生 > >短信平臺接口調用方法參考

短信平臺接口調用方法參考

msg class log ade array 調用方法 .com init text

http請求:
<?php $urlsend="http://xxx.com/api/MsgSend.asmx/sendMes"; $token=array("userCode"=>"用戶名","userPass"=>"密碼","DesNo"=>"手機號","Msg"=>"短信內容【簽名】","Channel"=>"通道號"); echo http($urlsend,$token,"GET"); //get請求 echo http($urlsend,$token,"POST"); //post請求 function http($url,$param,$action="GET"){ $ch=curl_init(); $config=array(CURLOPT_RETURNTRANSFER=>true,CURLOPT_URL=>$url); if($action=="POST"){ $config[CURLOPT_POST]=true; } $config[CURLOPT_POSTFIELDS]=http_build_query($param); curl_setopt_array($ch,$config); $result=curl_exec($ch); curl_close($ch); return $result; } ?>
webService請求:
<?php
    //此處僅示例發送短信,其他可類推
    header("Content-type: text/html; charset=utf-8");
    $client = new SoapClient("http://xxx.com/api/MsgSend.asmx?WSDL");
    $param = array("userCode"=>"用戶名","userPass"=>"密碼","DesNo"=>"手機號","Msg"=>"短信內容【簽名】","Channel"=>"通道號");
    $p = $client->sendMes($param);
    print_r($p);
    ?>

短信平臺接口調用方法參考