欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

我用curl请求接口获取返回值,但是不成功,大神给看看怎么调取?

程序员文章站 2022-04-27 08:45:33
...
接口地址 http://mp.vservice.com.cn/service/OutWebService?wsdl

接口调用方
callService(String serviceName,String servId,String secretKey,String xmlInfo)

参数名称 传值
serviceName:OAuth
servId :服务号id
secretKey :服务号秘钥
xmlInfo :
     
      333
      weixin/yixin
      info/base
      uri
     



这个是文档内容,服务号id和密钥就不公布,大神们给指导下怎么用curl获取返回值?


回复讨论(解决方案)

怎么没有人来回答

参考下http://blog.csdn.net/u011619326/article/details/38342421

用soap,不是用curl。
$servId = 'xxx';
$secretKey = 'xxx';
這兩處你改成你的賬號試試

333weixin/yixininfo/baseuri';    $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';
這兩處你改成你的賬號試試

333weixin/yixininfo/baseuri';    $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo);    var_dump($result);}catch(SOAPFault $e){      echo $e->getMessage();  }  ?>


非常感谢你,但是我运行之后提示 Not enough message parts were received for the operation.
不知该如何解决?


用soap,不是用curl。
$servId = 'xxx';
$secretKey = 'xxx';
這兩處你改成你的賬號試試

333weixin/yixininfo/baseuri';    $result = $client->callService($servicename, $servId, $secretKey, $xmlInfo);    var_dump($result);}catch(SOAPFault $e){      echo $e->getMessage();  }  ?>


非常感谢你,但是我运行之后提示 Not enough message parts were received for the operation.
不知该如何解决?

我是按你提供的参数做的,看了wsdl文档发现少了些参数









按照我这个肯定好用,求分。

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


很感谢