如何在php中使用Soap 1.1获取SellerCloud的数据,这是链接:http://tt.ws.sellercloud.com/scservice.asmx?op=Orders_GetDatas
以下是终点详细信息 : https://www.programmableweb.com/api/sellercloud |卖家云接口
以下是SellerCloud的API文档: http://developer.sellercloud.com/article/OoZlmewSpM-orders-get-datas
$wsdlurl = "http://tt.ws.sellercloud.com/scservice.asmx?WSDL";
$apiauth =array('UserName'=>'username','Password'=>'password', 'ApplicationVersion' => '5642', 'ApplicationVersion' => 'Testingname');
$header = new SoapHeader('http://api.sellercloud.com/', 'AuthHeader', $apiauth);
$soap = new SoapClient($wsdlurl)
$soap->__setLocation('http://tt.ws.sellercloud.com/scservice.asmx?WSDL');
$soap->__setSoapHeaders($header);
$params = array('orderIds'=> 5222241);
$soap->__soapCall("Orders_GetDatas", $params);
刚想通了。 绝对不直观。 请务必替换特定于您帐户的三条数据。
显然,这只是一个函数,但它显示了参数需要如何格式化。
<?
$wsdl = "http://[[server prefix]].ws.sellercloud.com/scservice.asmx?WSDL";
$namespace = "http://api.sellercloud.com/";
$sc = new SoapClient($wsdl, array(
"trace" => 1,
"exception" => 1
));
$apiauth = array(
'UserName' => "[[username]]",
'Password' => "[[password]]",
'ValidateDeviceID' => false
);
$header = array();
$header[] = new SoapHeader($namespace, 'AuthHeader', $apiauth, false);
$header[] = new SoapHeader($namespace, 'ServiceOptions');
$header[] = new SoapHeader($namespace, 'SerializableDictionaryOfStringString');
$sc->__setSoapHeaders($header);
$params = array(
'Filters' => array(
'Keys' => array('UseSP', 'DateFrom', 'DateTo'),
'Values' => array('GET', '07-01-2018 00:00:00', '07-01-2018 00:11:00')
)
);
try {
$response = $sc->Orders_Get($params);
var_dump($response);
} catch (Exception $e) {
print $e->getMessage() . "n"; exit();
}
?>