我正在尝试将 dotmailer 的 SOAP API 与 NUSOAP 一起使用,但我一点运气都没有。我可以连接到他们的服务器,但我根本无法获得任何信息。这是我到目前为止所得到的:
<?php
# initialise
$error_message="Something went wrong";
$wsdlPath = "https://apiconnector.com/v2/api.svc?wsdl";
# perform lookup
require "http://www.domain.com/nusoap/nusoap.php";
$client=new soapclient( $wsdlPath,'wsdl' );
$client->setCredentials("username","password");
$err=$client->getError();
if( $err ) { echo $error_message; exit( $err ); }
# create a proxy client.
$proxy=$client->getproxy();
$err=$proxy->getError();
if( $err ) { echo $error_message; exit( $err ); }
# call the SOAP method for GetAddressBooks.
$result=$proxy->GetAddressBooksResponse->GetAddressBooksResult;
if( $proxy->fault ) {
echo $error_message;
} else {
$err=$proxy->getError();
if( $err ) {
echo $error_message; exit( $err );
} else {
AddressBooks( $result );
}
}
function AddressBooks( $result ) {
print "<table>
<tr>
<th></th>
<th>Id</th>
<th>Name</th>
<th>Visibility</th>
<th>Contact</th>
</tr>";
foreach( $result['addressBook'] as $key=>$addressbook ) {
print "<tr>
<td>" . $addressbook->Id . "</td>
<td>" . $addressbook->Name . "</td>
<td align='right'>" . $addressbook->Visibility . "</td>
<td align='right'>" . $vaddressbook>Contacts . "</td>
</tr>";
}
print "</table>";
}
?>
我唯一得到的是第一行。我自己和 dotmailer 谈过,但他们根本没有任何帮助。