Heim > Artikel > Backend-Entwicklung > 我用curl请求接口获取返回值,但是不成功,大神给看看怎么调取?
接口地址 http://mp.vservice.com.cn/service/OutWebService?wsdl
接口调用方
callService(String serviceName,String servId,String secretKey,String xmlInfo)
参数名称 传值
serviceName:OAuth
servId :服务号id
secretKey :服务号秘钥
xmlInfo :
这个是文档内容,服务号id和密钥就不公布,大神们给指导下怎么用curl获取返回值?
怎么没有人来回答
参考下http://blog.csdn.net/u011619326/article/details/38342421
用soap,不是用curl。
$servId = 'xxx';
$secretKey = 'xxx';
這兩處你改成你的賬號試試
<?phptry{ $client = new SOAPClient('http://mp.vservice.com.cn/service/OutWebService?wsdl'); $servicename = 'OAuth'; $servId = 'xxx'; $secretKey = 'xxx'; $xmlInfo = '<?xml version="1.0" encoding="UTF-8"?><BaseInfo><servId>333</servId><platform>weixin/yixin</platform><type>info/base</type><redirect_uri>uri</redirect_uri></BaseInfo>'; $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo); var_dump($result);}catch(SOAPFault $e){ echo $e->getMessage(); } ?>
这个明明是webservice的调用,你为什么用curl
用SOAP获取。
用soap,不是用curl。
$servId = 'xxx';
$secretKey = 'xxx';
這兩處你改成你的賬號試試
<?phptry{ $client = new SOAPClient('http://mp.vservice.com.cn/service/OutWebService?wsdl'); $servicename = 'OAuth'; $servId = 'xxx'; $secretKey = 'xxx'; $xmlInfo = '<?xml version="1.0" encoding="UTF-8"?><BaseInfo><servId>333</servId><platform>weixin/yixin</platform><type>info/base</type><redirect_uri>uri</redirect_uri></BaseInfo>'; $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo); var_dump($result);}catch(SOAPFault $e){ echo $e->getMessage(); } ?>
用soap,不是用curl。
$servId = 'xxx';
$secretKey = 'xxx';
這兩處你改成你的賬號試試
<?phptry{ $client = new SOAPClient('http://mp.vservice.com.cn/service/OutWebService?wsdl'); $servicename = 'OAuth'; $servId = 'xxx'; $secretKey = 'xxx'; $xmlInfo = '<?xml version="1.0" encoding="UTF-8"?><BaseInfo><servId>333</servId><platform>weixin/yixin</platform><type>info/base</type><redirect_uri>uri</redirect_uri></BaseInfo>'; $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo); var_dump($result);}catch(SOAPFault $e){ echo $e->getMessage(); } ?>
按照我这个肯定好用,求分。
try { $xml='xml数据'; //地址 $soap = new SoapClient ( "http://mp.vservice.com.cn/service/OutWebService?WSDL" ); //请求参数 根据你的参数调整 $param = array ('userName' => '*****', 'pwd' => '****', 'businessType' => 'SaleHouses', 'xmlContent' => $xml ); //调用服务器端的方法 根据你的方法调整 我这里Import是方法名称 $result = $soap->__soapCall ( 'Import', array ('parameters' => $param ) ); print_r ( $result ); } catch ( SoapFault $e ) { echo $e->getMessage (); } catch ( Exception $E ) { echo $E->getMessage (); }
参考下http://blog.csdn.net/u011619326/article/details/38342421