PHP Classes

File: ex2.php

Recommend this page to a friend!
  Classes of Mike Frank   Zip/Postal Code Lookup Class   ex2.php   Download  
File: ex2.php
Role: Example script
Content type: text/plain
Description: Example 2 - Calculating distance
Class: Zip/Postal Code Lookup Class
Retrieve geographical location for given zip codes
Author: By
Last change:
Date: 15 years ago
Size: 775 bytes
 

Contents

Class file image Download
<?php
include 'class.geodata.inc.php';

$lookup = new EyeGeoData();

// Lookup postal code M5X 1J2
print_r($lookup->query('M5X 1J2'));
/*Array
(
    [PostalCode] => M5X1J2
    [City] => TORONTO
    [Province] => ON
    [Country] => CA
    [AreaCode] => 416
    [TimeZone] => 5
    [Coordinates] => Array
        (
            [Latitude] => 43.648306
            [Longitude] => -79.38224
        )

)*/
 
// Lookup zip code 90210
print_r($lookup->query('90210'));
/*Array
(
    [PostalCode] => 90210
    [City] => BEVERLY HILLS
    [Province] => CA
    [Country] => US
    [AreaCode] => 310
    [TimeZone] => 8
    [Coordinates] => Array
        (
            [Latitude] => 34.103131
            [Longitude] => -118.416253
        )

)*/