PAVv3 Php

From CDYNE Wiki
Jump to: navigation, search

Using as a Service Reference(.NET Framework 3.5+)

http://pav3.cdyne.com/PavService.svc?wsdl

Contents

Get Congressional District By Zip

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'ZipCode'=> '23320'
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetCongressionalDistrictByZip($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Get City Names For Zip Code

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'ZipCode'=> '23320'
,'LicenseKey'=> 'YOUR LICENSE KEY'
);
$result = $client->GetCityNamesForZipCode($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Get Zip Codes For City And State

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'City'=> 'Chesapeake'
,'State'=> 'VA'
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetZipCodesForCityAndState($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Get Urbanization List For ZipCode

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'ZipCode'=> '23320'
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetUrbanizationListForZipCode($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Verify Address

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'FirmOrRecipient' => 'CDYNE'
,'PrimaryAddressLine' => '505 Independence Parkway'
,'SecondaryAddressLine' => 'Suite 300'
,'Urbanization' => ''
,'CityName' => 'Chesapeake'
,'State' => 'VA'
,'ZipCode' => '23320'
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->VerifyAddress($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Verify Address Advanced

Calling Verify Address Advanced using SOAP Client.

<?php
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;
}
}
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$request = new VerifyAddressAdvancedRequestData('Chesapeake','CDYNE','YOUR LICENSE KEY','505 Independence Parkway','Suite 300','VA','','23320');
$result = $client->VerifyAddressAdvanced($request);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

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);

Get Intelligent Mail Barcode

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'BarcodeIdentifier'=> '12'
,'ServiceTypeIdentifier'=> '123'
,'MailerIdentifier'=> '123456'
,'SerialNumber'=> '123456789'
,'IntelligentMailBarcodeKey'=> 'dw/cKC9h9Au0zJy+WGvQkQ=='
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetIntelligentMailBarcode($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Get Zip Codes For Fips

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'Fips'=> '51550'
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetZipCodesForFips($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Get Zip Codes Within Distance

<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'Latitude'=> '36.761560'
,'Longitude'=> '-76.259964'
,'Radius'=>'5'
,'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetZipCodesWithinDistance($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>

Back to Postal_Address_Verification_V3

Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key