Affilinet WSDL php脚本 - >输出为XML

时间:2017-05-03 11:44:50

标签: php soap

我已经从Affilinet复制了WSDL / php脚本,并希望从中创建一个xml文件,因此我可以将其导入Woocommerce。

到目前为止我有这个代码:

<?php

// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_WS", "https://api.affili.net/V2.0/PublisherInbox.svc?    wsdl");

// Set credentials
$username = 'xxxxx'; // the publisher ID
$password = 'xxxxxxxxxxx'; // the publisher web services password

// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
'Username'  => $username,
'Password'  => $password,
'WebServiceType' => 'Publisher'
));

// Set DisplaySettings parameters
$displaySettings = array(
'CurrentPage' => 1,
'PageSize' => 1000,
'SortBy' => 'LastChangeDate',
'SortOrder' => 'Descending'
 );

// Set SearchVoucherCodesRequestMessage parameters
$params = array(
'StartDate' => strtotime("now"),
'EndDate' => strtotime("now"),
'VoucherCodeContent' => 'Filled',
'VoucherType' => 'AllProducts'
);

// Send a request to the Publisher Inbox Service
$soapRequest = new SoapClient(WSDL_WS);
$response = $soapRequest->SearchVoucherCodes(array(
'CredentialToken' => $token,
'DisplaySettings' => $displaySettings,
'SearchVoucherCodesRequestMessage' => $params
));

// Show response
//print_r($response);

echo '<pre>'; print_r($response); echo '</pre>';

像这样的代码将stdClass对象作为数组返回。

如何从中获取xml输出?

任何帮助将不胜感激。

非常感谢。 Karolin

0 个答案:

没有答案