我尝试不同方式的post方式请求,要么完全请求不到东西,要么接收到乱码,均以失败告终。
针对顺丰接口的soap请求的核心代码分享如下:
代码如下
/**
* 发送soap请求
*/
private function _soap()
{
$client = new soapclient($this->serviceurl);
$info = new stdclass();
$info->arg0 = $this->xml;
$param = array($info);
$response = $client->__call(“sfexpressservice”,$param);
return $response->return ;
}
/**
* 拼接出请求的xml
*/
public function createxml()
{
$xml = ‘
’.$this->user.’,’.$this->password.’
invoice_no.’” />
’;
$this->xml = $xml;
}
提示:
1.$this->serviceurl 顺丰分配的bsp请求地址,注意是?wsdl的地址
2.$this->user,$this->password 即是顺丰分配的id和校验码
3.返回的return是一个xml的string,你可能需要simplexml_load_string来解析。
http://www.bkjia.com/phpjc/898890.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/898890.htmltecharticle顺丰bsp订单号查询接口soap的请求示例 在一些接口的设计中有时用到了soap方式的请求,比如顺丰bsp的接口。 我尝试不同方式的post方式请求...
