Page tree
Skip to end of metadata
Go to start of metadata

Phone Exchange Code Snippets

The following section is designed for developers looking to integrate our DOTS Address Geocode - CA 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:

Phone Exchange Code Snippet using PHP

define("DOTS_Service_Path", '');
$phoneNumbers = "";
$licenseKey = "";
if( isset($_POST['PhoneNumbers']) ) $phoneNumbers = $_POST['PhoneNumbers'];
if( isset($_POST['LicenseKey']) ) $licenseKey = $_POST['LicenseKey'];

//Create a SOAP client to consume the service
//		the php_soap.dll extension must be declared
//		the page has instructions
//		for enabling this extension in your php config file, php.ini
$soapClient = new SoapClient( DOTS_Service_Path."?WSDL" );
$params['PhoneNumbers'] = $phoneNumbers;
$params['LicenseKey'] = $licenseKey;

//Consume GetExchangeInfo_V2 Service
$result = $soapClient->GetExchangeInfo_V2($params)->GetExchangeInfo_V2Result;

if( !isset($result->Error) ) {
	// display SOAP response data

	// Check to see how many provisers we are returning, if multiple point to provider objects
	if(($result->Providers->Provider) > 1){
	$providers = $result->Providers->Provider;

	// Only one provider returned. Set up the object to handle the single case
		$providers = $result->Providers;
  • No labels