Keys →
Functions ↓
function zipToLL ( $zip ) {#-k geo#- zipcode to Latitude/Longitude#-p $zip - req - zipcode (USA) or postcode (Canada or UK)#-p $ar - ret - array ['e'] =0 if no error#-p ['lat']#-p ['lon']#-p ['tz'] timezone#-p ['cc'] country code#-p ['state']#-p ['city']#-p ['DST'] DST offset; 0 if none# postcode validation template. if Canada supported, add '9a9'; if AU, add '9999' $template = array ( '99999', 'a99', 'a9a', 'a9', 'aa99', 'aa9a', 'aa9', '9a9' ); $ar['e'] = 1; # default to not found if (validateTemplate($zip,$template,1) >- 1) { serverLoad(); # this will only try to load the first time thru if ($sq['e'] > 0) { return $ar; } $zipcode = shift ( trim($zip) ); $sq = findZip ( 0, $zipcode ); if (!$sq['e']) { $ar['e'] = 0; # found $ar['lat'] = trim($sq['zip'][0]['lat']); $ar['lon'] = trim($sq['zip'][0]['lon']); $ar['tz'] = $sq['zip'][0]['tz']; $ar['cc'] = $sq['zip'][0]['cc']; $ar['city'] = ucwords ( shift($sq['zip'][0]['city'],1) ); $ar['state'] = $sq['zip'][0]['st']; $ar['DST'] = $sq['zip'][0]['DST']; if ($ar['DST'] && is_ccInDST ( $cc, time() )) { $ar['tz'] += $sq['zip'][0]['DST']; } } } return $ar; }?>?>