鍍金池/ 問答/PHP  HTML/ PHP調(diào)用webservice接口

PHP調(diào)用webservice接口

公司有個同事在用PHP調(diào)用webservice接口,但是一直提示失敗,數(shù)據(jù)無法交互,我本身不懂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個方法看看接口那邊要的參數(shù)格式和鍵名是啥,soap的接口很奇怪的

2017年10月12日 01:00