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);
?>