PHP如何调用webservice

2020-05-31 社会 72阅读
SOAP的WebService是可以直接使用的,php有支持SoapClient的,用起来很容易
$wsdl = "";
$client = new SoapClient($wsdl);
$param = array('arg0'=>'arg0','arg1'=>'arg1');
$ret = $client->getUserinfoByID($param);
if ($ret->return){
print_r($ret->return);
}else{
echo 'no user';
}
具体SoapClient需要php的soap支持,看phpinfo里有soap的话就可以了,比如这样:
soap
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 1 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com