PAVv3 Php
From CDYNE Wiki for Web Services
Using as a Service Reference(.NET Framework 3.5+)
http://pav3.cdyne.com/PavService.svc?wsdl
Contents |
Get Congressional District By Zip
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl'); $param = array( 'ZipCode'=> '23462' ,'LicenseKey' => '' ); $result = $client->GetCongressionalDistrictByZip($param); print_r($result);
Get City Names For Zip Code
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl'); $param = array( 'ZipCode' => '23462' ,'LicenseKey' => '' ); $result = $client->GetCityNamesForZipCode($param); print_r($result);
Get Zip Codes For City And State
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl'); $param = array( 'City' => 'Chesapeake' ,'State' => 'VA' ); $result = $client->GetZipCodesForCityAndState($param); print_r($result);
Get Urbanization List For ZipCode
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl'); $param = array( 'Zip' => '23323' ); $result = $client->GetUrbanizationListForZipCode($param); print_r($result);
Verify Address
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl'); $param = array( 'FirmOrRecipient' => 'Cdyne' ,'PrimaryAddressLine' => '600 Pintail Ln' ,'SecondaryAddressLine' => '' ,'Urbanization' => '' ,'CityName' => 'Chesapeake' ,'State' => 'VA' ,'ZipCode' => '23320' ,'LicenseKey' => '' ); $result = $client->VerifyAddress($param); print_r($result);
Verify Address Advanced
Calling Verify Address Advanced using SOAP Client.
//Function to create request object class VerifyAddressAdvancedRequestData{ public $Request; function VerifyAddressAdvancedRequestData($CityName, $FirmOrRecipient, $LicenseKey, $PrimaryAddressLine, $SecondaryAddressLine, $State, $Urbanization, $ZipCode) { $this->Request = array(); $this->Request['CityName'] = $CityName; $this->Request['FirmOrRecipient'] = $FirmOrRecipient; $this->Request['LicenseKey'] = $LicenseKey; $this->Request['PrimaryAddressLine'] = $PrimaryAddressLine; $this->Request['SecondaryAddressLine'] = $SecondaryAddressLine; $this->Request['State'] = $State; $this->Request['Urbanization'] = $Urbanization; $this->Request['ZipCode'] = $ZipCode; } } //Construct soap client $client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl'); //Construct request object with values $request = new VerifyAddressAdvancedRequestData('Chesapeake','','00000000-0000-0000-0000-000000000000','2125 Smith Ave','Suite 200','VA','','23320'); //Call VerifyAddressAdvanced from service and pass it the request $result = $client->VerifyAddressAdvanced($request); //Display results of api call print_r($result);
Verify Address Advanced (With cURL)
Calling Verify Address Advanced using cURL and json.
//Request paramters in json format $json = '{ "CityName":"Chesapeake" ,"FirmOrRecipient":"" ,"LicenseKey":"(Your Key)" ,"PrimaryAddressLine":"2125 Smith Ave" ,"SecondaryAddressLine":"" ,"State":"VA" ,"Urbanization":"" ,"ZipCode":"23320" }'; //Method $url = 'http://pav3.cdyne.com/PavService.svc/VerifyAddressAdvanced'; $cURL = curl_init(); curl_setopt($cURL,CURLOPT_URL,$url); curl_setopt($cURL,CURLOPT_POST,true); curl_setopt($cURL,CURLOPT_POSTFIELDS,$json); curl_setopt($cURL,CURLOPT_RETURNTRANSFER, true); curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json')); //If you desire your results in xml format, use the following line for your httpheaders and comment out the httpheaders code line above. //curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $result = curl_exec($cURL); curl_close($cURL); print_r($result);
Back to Postal_Address_Verification_V3
