公司有个同事在用PHP调用webservice接口,但是一直提示失败,数据无法交互,我本身不懂PHP的,我见他可能忙不过来,帮他上来提问一哈,先谢谢各位大佬帮忙解答
$usertoken='****';
$url='http://********';
$arr_data=array('shopNo'=>2,'date'=>date('Y-m-d'),'data'=>array('spNum'=>'***==','isBuy'=>0,'price'=>"1.00"));
$json_data=json_encode($arr_data);
//$str_url=$url."?usertoken=".$usertoken."&data=".$json_data;
//echo $str_url;exit;
$data=array("usertoken"=>$usertoken,"data"=>'2134564');
$client = new SoapClient($url,array('track' => 1));
try {
$response=$client->__call('HelloWorld',$data);
print_r($response->HelloWorldResult);
} catch (SoapFault $e) {
print_r($e->getMessage());
}
exit;
这是他的代码,这个代码贴出来能看出问题吗
$client->__getFunctions (); //获取接口上能用的方法
$client->__getTypes(); //获取方法的键名 非常重要
用这2个方法看看接口那边要的参数格式和键名是啥,soap的接口很奇怪的