I'm trying to use dotmailer's SOAP API with NUSOAP but I'm not having any luck at all. I can connect to their servers okay but I can't get any information at all. This is what I've got so far:
<?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>";
}
?>
The only thing I get is the first table row. I've spoken to dotmailer themselves but they've not been any help at all.