<?php
$client = new SoapClient("https://addressinfo.northern911.com/soap/Service.svc?wsdl", array("classmap" => array("Customer" => "MyCustomer")));
$vendorCode = '955';
$soap_passcode = 'asdlfkj()*$JFU)SDf)SDuf';
$gmdate = gmdate('Ymd'); //YYYYMMDD
$hash = md5($vendorCode . $soap_passcode . $gmdate);
$newCustomer = new MyCustomer();
$newCustomer->VENDOR_CODE = "955";
$newCustomer->PHONE_NUMBER = "7055551234";
$newCustomer->LAST_NAME = "Doe";
$newCustomer->FIRST_NAME = "John";
$newCustomer->STREET_NUMBER = "123";
$newCustomer->SUITE_APT = "";
$newCustomer->STREET_NAME = "Main Street";
$newCustomer->CITY = "Sudbury";
$newCustomer->PROVINCE_STATE = "ON";
$newCustomer->POSTAL_CODE_ZIP = "P3A 2Z7";
$newCustomer->OTHER_ADDRESS_INFO = "Front Door";
$newCustomer->ENHANCED_CAPABLE = "N";
$newCustFields = array("customer" => $newCustomer, "hash" => $hash);
$AddUpdateCustomerResult = $client->AddorUpdateCustomer($newCustFields)->AddorUpdateCustomerResult;
//Transaction not accepted. Therefore display error message(s).
if (!$AddUpdateCustomerResult->Accepted)
{
echo 'Add/Update not accepted.' . '<br/><br/>';
$errors = $AddUpdateCustomerResult->Errors->Error;
$errorCount = count($errors);
//If 1 error message. Display it.
if ($errorCount == 1)
{
echo 'Error-Code: ' . $errors->ErrorCode . '<br/>';
echo 'Error-Msg: ' . $errors->ErrorMessage . '<br/>';
}
//If multiple error messages display them all.
else
{
foreach ($errors as &$err)
{
echo 'Error-Code: ' . $err->ErrorCode . '<br/>';
echo 'Error-Msg: ' . $err->ErrorMessage . '<br/><br/>';
}
}
}
else
{
echo 'Add/Update accepted.';
}
class MyCustomer
{
public $VENDOR_CODE = null;
public $PHONE_NUMBER = null;
public $LAST_NAME = null;
public $FIRST_NAME = null;
public $STREET_NUMBER = null;
public $SUITE_APT = null;
public $STREET_NAME = null;
public $CITY = null;
public $PROVINCE_STATE = null;
public $POSTAL_CODE_ZIP = null;
public $OTHER_ADDRESS_INFO = null;
public $ENHANCED_CAPABLE = null;
public $LAST_DATETIME_MODIFIED = null;
public $LAST_DATETIME_MODIFIED_UNIXTIME = null;
}
?>