Calling Verify Address Advanced using cURL and json.
<?php
//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);
?>
<pre>
<?php
$param = array(
'FirmOrRecipient' => 'CDYNE'
,'PrimaryAddressLine' => '505 Independence Parkway'
,'SecondaryAddressLine' => 'Suite 300'
,'Urbanization' => ''
,'CityName' => 'Chesapeake'
,'State' => 'VA'
,'ZipCode' => '23320'
,'LicenseKey' => f01d89fd-5155-5455-5585-e84ab8de8591'
);
$queryString = http_build_query($param);
$url = 'http://pav3.cdyne.com/PavService.svc/VerifyAddress' . '?' . $queryString;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPGET,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Accept: application/json'));
$response = curl_exec($ch);
curl_close($ch);
$array = json_decode($response);
print_r($array);
?>
</pre>