php调用w eb s ervic es两种方法s oap和curl
以http://www.w ebxml.c om.c n/zh_c n/index.as px
一、使用soap调用
?p hp
//服务器支持soap扩展:
/*Example 1:
$c lient=new SoapClient(http://fy.w ebxml.c om.cn/w ebs ervic es/EnglishChines e.asmx?w s dl$parameters=array(w ordKey=test
//中英文双向翻译返回数据数组
$result=$c lient-Trans latorString($parameters);echo preprint_r($result-TranslatorStringResult).br/echo/pre
//中英文双向翻译返回数组含句子例子
$result1=$client-Translator($parameters);echo preprint_r($result1-TranslatorResult).br/echo/pre
//获得候选词
$result2=$c lient-SuggestWord($parameters);echo preprint_r($result2-SuggestWordResult).br/
echo/pre
//获得朗读MP3字节流,返回数据字节数组Byte[]
$result3=$c lient-GetMp3($parameters);echo preprint_r($result3).br/echo/pre
$c lient = newSoapClient(http://w ebs ervic e.w ebxml.c om.cn/WebServic es/IpAddres s S earchWebS ervic e.asmx?ws dl
$param=array(‘theIpAddres s’=‘202.96.134.33’);
$res ult=$c lient-getCountryCity ByIp($param);echo preprint_r($result-getCountryCity ByIpResu lt);echo/pre
$result 1=$c lient-getGeoIPContext($param);echo preprint_r($result 1);echo/pre
$result2=$c lient-getVers ionTime(echo preprint_r($result2);echo/pre
//Ex amp le 3:
$c lient = newSoapClient(http://w ebs ervic e.w ebxml.c om.cn/WebS ervic es/MobileCodeWS.asmx?ws dl
//获得国内手机号码归属地省份、地区和手机卡类型信息
$parm=array(‘mobileCode’=‘1367007’ ,’userID’=
$result=$c lient-getMobile CodeInfo($parm);echo($result-getMobileCodeInfoResult).br
//获得国内手机号码归属地数据库信息
$result 1=$c lient-getDatabas eInfo($parm);print_r($result 1).br
//获取SOAP类型列表(Returns list of SOAP types )echo‘preprint_r($c lient-__getTyp es ()) ;echo‘ /pre
//获取w ebs ervic e提供的函数echo‘preprint_r($c lient-__getFunc tions ()) ;echo‘ /pre
//服务器不支持soap扩展的情况下可引入网上开源的类库
?
二、使用curl中POST
?p hpcPost(‘l8200352367’);
*使用CURL中P O S T方式提交数据
*@param string$xml要提交的$xml数据function c Post($phone){
$curlPost=mobileCode=$phone userID=
$ch=curl_init();//初始化curl会话返回一个句柄curl_s etopt($ch, CURLOPT_URL,http://w ebs ervic e.w ebxml.c om.cn/WebServic es/Mobile CodeWS.asmx/getMobileCodeInfocurl_s etopt($c h, CURLOPT_POST, 1);//启用时会发送一个常规的POST请求类型为applic ation/x-www-form-urlenc oded就像表单提交的一样curl_s etopt($ch,CURLOPT_POSTFIELDS, $curlPost);curl_s etopt($ch,CURLOPT_RET URNTRANSFER, 1);//将curl_exec()获取的信息以文件流的形式返回而不是直接输出
$res=curl_exec($ch);curl_close($ch);v ar_dump($r es);
}
前几天看到网友反馈到PacificRack商家关于处理问题的工单速度慢,于是也有后台提交个工单问问,没有得到答复导致工单自动停止,不清楚商家最近在调整什么。而且看到有网友反馈到,PacificRack 商家的之前年付低价套餐全部下架,而且如果到期续费的话账单中的产品价格会涨价不少。所以,如果我们有需要续费产品的话,谨慎选择。1、特价产品下架我们看到他们的所有原来发布的特价方案均已下架。如果我们已有...
Virmach 商家算是比较久且一直在低价便宜VPS方案中玩的不亦乐乎的商家,有很多同时期的商家纷纷关闭转让,也有的转型到中高端用户。而前一段时间也有分享过一次Virmach商家推出所谓的一次性便宜VPS主机,比如很低的价格半年时间,时间到服务器也就关闭。这不今天又看到商家有提供这样的产品。这次的活动产品包括圣何塞和水牛城两个机房,为期六个月,一次性付费用完将会取消,就这么特别的产品,适合短期玩玩...
a400互联是一家成立于2020年商家,主营美国机房的产品,包括BGP线路、CN2 GIA线路的云服务器、独立服务器、高防服务器,接入线路优质,延迟低,稳定性高,额外也还有香港云服务器业务。当前,全场服务器5折,香港VPS7折,洛杉矶VPS5折,限时促销!A400互联官网:https://a400.net/优惠活动全场独服永久5折优惠(续费同价):0722香港VPS七折优惠:0711洛杉矶VPS五...