Address Validation Plus – US Code Snippets

The following section is designed for developers looking to integrate our DOTS Address Validation Plus – US service into their applications or websites.  Code snippets are designed to give a quick look at how to make the call and collect the result.  They are not complete solutions, but helpful for developers that just need a basic starting point.  We will continue to add new snippets of different languages to this list from time to time.  For sample code in additional languages or more complete example applications please visit our website sample code page: https://www.serviceobjects.com/developers/sample-code/.

Address Validation Plus Code Snippet using PHP

// (Optional) This turns off the WSDL caching, which is on by default.
ini_set("soap.wsdl_cache_enabled","0");
 
// Set these values per web service <as needed>
$wsdlUrl = "https://trial.serviceobjects.com/ap/AddressPlus.asmx?WSDL";
 
// Create the SoapClient and pass the URL to the WSDL file and optional parameters as needed
//$soapClient = new SoapClient($wsdlUrl, array("trace" => true, "exceptions" => false,));
$soapClient = new SoapClient($wsdlUrl);
 
// If GET information exists, insert into variables
 $Address = $_GET['Address'];
 $Address2 = $_GET['Address2'];
 $City = $_GET['City'];
 $State = $_GET['State'];
 $Zip = $_GET['Zip'];
 
// http get of the key
if(isset($_GET['LicenseKey']))
 $LicenseKey = $_GET['LicenseKey'];
 
// Variable to tell if the form was submitted
if(isset($_GET['Action']))
 $Action = $_GET["Action"];