3dcart SOAP API response



我一直在尝试在PHP中进行3dcart API的交互。

<?php
/** define the SOAP client using the url for the service**/
$SoapiClient = new soapclient('http://api.3dcart.com/cart.asmx?WSDL', array('trace' => 1));
/*array trace helps so that we can see previous soap transactions for details see php.net documentation*/
/**create an array of parameters for geting the info of a customer**/
$storeUrl="store.3dcartstores.com/"; //the provided store URL
$userKey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // the provided password
$callBackURL=""; // the URL in which the result will be put
$batchSize=1; // the batch number
$startNum="2"; // the starting number
$customersFilter=""; // the customer filter
$thearray = array('storeUrl' => $storeUrl, 'userKey' => $userKey,
'callBackURL' => $callBackURL, 'batchSize' => $batchSize, 'customersFilter' => $customersFilter, 'startNum' => $startNum);
/** call the service, passing the parameters and the name of the operation **/
$result = $SoapiClient->getCustomer($thearray); 
/** a quick test **/
if (is_soap_fault($result)):
echo '<h1>ERRRO</h1><pre>';
print_r($result);
echo '</pre>';
else:
echo '<h1>Working FINE</h1><pre>';
print_r($result->getCustomerResult->any);
echo '</pre>';
endif;
?>

现在我的问题从这里开始,结果是一个包含所有信息的字符串,它没有空格,也没有格式化为数组或对象。

特异反应:

工作正常

2NameFname Str. Nr.17VegasNevada400500USAHome00101234567890user@mail.comNameFname Str。Nr.17 c12LasVegasNevada400500USAHome00101234567890/7/2015123456789008/7/20151

我如何得到这个信息作为一个数组或对象?

第二个问题是customersFilter的命令是什么?它是做什么的,怎么做的?

使用php的simplexml_load_string()函数返回字符串作为SimpleXMLElement对象:

http://php.net/manual/en/function.simplexml-load-string.phphttp://php.net/manual/en/class.simplexmlelement.php

customersFilter允许通过电子邮件地址过滤结果

最新更新