| Server IP : 172.67.178.83 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/gotofindhomes.com3/components/Address/ |
Upload File : |
<?php
/**
* Documentation
* @author evgeniy
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2011 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class Address_Zip extends System_Db_Object
{
/**
* Get zip code by address
*/
public static function parseZipCode($state,$city,$address){
$url = 'https://tools.usps.com/go/ZipLookupResultsAction!input.action?resultMode=0';
$url .= '&address1='.urlencode($address);
$url .= '&city='.urlencode($city);
$url .= '&state='.urlencode($state);
try{
if (function_exists('curl_version')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);
curl_close($ch);
} else {
$client = new Zend_Http_Client($url, array(
'maxredirects' => 0,
'timeout' => 30,
'useragent' => 'CharlesUserAgent1.0'));
$response = $client->request();
$html = $response->getBody();
}
$dom = new Zend_Dom_Query($html);
$results = $dom->query('span.zip');
foreach ($results as $currZip) {
return trim($currZip->nodeValue);
}
return false;
}catch (Exception $e){
LogSystem::addLog('Address_Zip','parseZipCode','',0,LogSystem::SEVERITY_CRIT,$e->getMessage(),array());
return false;
}
}
}