Postal Code Solution

Buy it now at CodeCanyon.

Go to demo website.

Demo search results are limited to a maximum of 10 records.

Introduction

Postal Code Solution aims to help anyone who needs light-weight postal code data source solutions in their web applications. We care about the valuable time developers spend, so we offer the solution.

Features

Rich Data

93 countries of postal code data sets with over 1.5 million records. Each row of postal code consists of country code, zip code, city, county, county code, state, state code, latitude, longitude.

API Ready

API provides search and get functions based on postal code, city, state, county, and coordinates. Give you the maximum flexibility in your own business needs.

Easy Integration

We work hard to save your time and effort in terms of integration. Focusing on your own part, and we provide integrations with just a few copy and paste.

Buy it now at CodeCanyon.

Installation

  1. Create a database, or use your existing database.
  2. Go to http://your-domain.com/importer.php to start import postal code data file.
  3. Fill out database information, and choose your desired country of postal data. If you want all countries, use the allCountries.txt file.
  4. Click Import Now button, and wait for the process to finish.
  5. Delete importer.php
  6. You are ready to use Postal Code Solution in your web application development.

Available Country Abbreviation – Country :

AD – Andorra, AR – Argentina, AS – American Samoa, AT – Austria, AU – Australia, AX – Aland Islands, AZ – Azerbaijan, BD – Bangladesh, BE – Belgium, BG – Bulgaria, BM – Bermuda, BR – Brazil, BY – Belarus, CA – Canada, CH – Switzerland, CL – Chile, CO – Colombia, CR – Costa Rica, CZ – Czech Republic, DE – Germany, DK – Denmark, DO – Dominican Republic, DZ – Algeria, EE – Estonia, ES – Spain, FI – Finland, FM – Federated States of Micronesia, FO – Faroe Islands, FR – France, GB – Great Britain, GF – French Guiana, GG – Guernsey, GL – Greenland, GP – Guadeloupe, GT – Guatemala, GU – Guam, HR – Croatia (Hrvatska), HU – Hungary, IE – Ireland, IM – Isle of Man, IN – India, IS – Iceland, IT – Italy, JE – Jersey, JP – Japan, KR – Korea, Republic of, LI – Liechtenstein, LK – Sri Lanka, LT – Lithuania, LU – Luxembourg, LV – Latvia, MC – Monaco, MD – Moldova, MH – Marshall Islands, MK – Macedonia, Former Yugoslav Republic of, MP – Northern Mariana Islands, MQ – Martinique, MT – Malta, MW – Malawi, MX – Mexico, MY – Malaysia, NC – New Caledonia, NL – Netherlands, NO – Norway, NZ – New Zealand, PE – Peru, PH – Philippines, PK – Pakistan, PL – Poland, PM – Saint Pierre and Miquelon, PR – Puerto Rico, PT – Portugal, PW – Palau, RE – Reunion, RO – Romania, RS – Serbia, RU – Russian Federation, SE – Sweden, SG – Singapore, SI – Slovenia, SJ – Svalbard & Jan Mayen Islands, SK – Slovakia (Slovak Republic), SM – San Marino, TH – Thailand, TR – Turkey, UA – Ukraine, US – United States, UY – Uruguay, VA – Holy See (Vatican City State), VI – United States Virgin Islands, WF – Wallis and Futuna, YT – Mayotte, ZA – South Africa

  • For Canada, we have only the first letters of the full postal codes (for copyright reasons)
  • For Chile, we have only the first digits of the full postal codes (for copyright reasons)
  • For Ireland, we have only the first letters of the full postal codes (for copyright reasons)
  • For Malta, we have only the first letters of the full postal codes (for copyright reasons)
  • The Argentina data file contains the first 5 positions of the postal code.
  • For Brazil only major postal codes are available (only the codes ending with -000 and the major code per municipality).

Documentation

Demo data are limited to a maximum of 10 results.

API

How to use
GET /api.php?action=xxx&data=xxx&country=xx (action is API function, data is function parameters, and country is country abbreviation of 2 letters)

Please edit database information at line 9 of the api.php file before using the api.php.

function: search
General search based on zip, city, county, county code, state, state code. 
action: search 
data: search keyword 
country: country abbreviation of 2 letters
usage: /api.php?action=search&data=seattle
demo: /api.php?action=search&data=seattle&country=us
demo: /api.php?action=search&data=portland&country=us

function: searchByCity
Search by city name. 
action: searchByCity 
data: city name 
country: country abbreviation of 2 letters
usage: /api.php?action=searchByCity&data=seattle
demo: /api.php?action=searchByCity&data=seattle&country=us
demo: /api.php?action=searchByCity&data=austin&country=us

function: searchByCounty
Search by county name. 
action: searchByCounty 
data: county name 
country: country abbreviation of 2 letters
usage: /api.php?action=searchByCounty&data=dallas
demo: /api.php?action=searchByCounty&data=dallas&country=us
demo: /api.php?action=searchByCounty&data=orange&country=us

function: searchByState
Search by state name. 
action: searchByState 
data: state name 
country: country abbreviation of 2 letters
usage: /api.php?action=searchByState&data=texas
demo: /api.php?action=searchByState&data=texas&country=us
demo: /api.php?action=searchByState&data=california&country=us

function: searchByCountyCode
Search by state code. 
action: searchByCountyCode 
data: state code 
country: country abbreviation of 2 letters
usage: /api.php?action=searchByCountyCode&data=033
demo: /api.php?action=searchByCountyCode&data=033&country=us
demo: /api.php?action=searchByCountyCode&data=043&country=us

function: searchByPostalCode
Search by postal code. 
action: searchByPostalCode 
data: postal code 
country: country abbreviation of 2 letters
usage: /api.php?action=searchByPostalCode&data=7528
demo: /api.php?action=searchByPostalCode&data=7528&country=us

function: searchByCoordinates
Search by coordinates, the function gives will search all available zips within 5 miles(default) of the given coordinates. 
action: searchByPostcode 
data: latitude,longitude or latitude,longitude,distance 
country: country abbreviation of 2 letters
usage: /api.php?action=searchByCoordinates&data=47.4323,-121.803 
usage: /api.php?action=searchByCoordinates&data=47.4323,-121.803,10
demo: /api.php?action=searchByCoordinates&data=47.4323,-121.803&country=us
demo: /api.php?action=searchByCoordinates&data=47.4323,-121.803,50&country=us

function: getByCity
Get result by a city name. 
action: getByCity 
data: city name 
country: country abbreviation of 2 letters
usage: /api.php?action=getByCity&data=plano
demo: /api.php?action=getByCity&data=plano&country=us

function: getByCityState
Get result by a city name and a state name. 
action: getByCityState 
data: city name,state name 
country: country abbreviation of 2 letters
usage: /api.php?action=getByCityState&data=plano,texas
demo: /api.php?action=getByCityState&data=plano,texas&country=us

function: getByCounty
Get result by a county name. 
action: getByCounty 
data: county name 
country: country abbreviation of 2 letters
usage: /api.php?action=getByCounty&data=dallas
demo: /api.php?action=getByCounty&data=dallas&country=us

function: getByState
Get result by a state name. 
action: getByState 
data: state name 
country: country abbreviation of 2 letters
usage: /api.php?action=getByState&data=texas
demo: /api.php?action=getByState&data=texas&country=us

function: getByStateCode
Get result by a state code. 
action: getByStateCode 
data: state code 
country: country abbreviation of 2 letters
usage: /api.php?action=getByStateCode&data=ca
demo: /api.php?action=getByStateCode&data=ca&country=us

function: getByCountyCode
Get result by a county code. 
action: getByCountyCode 
data: county code 
country: country abbreviation of 2 letters
usage: /api.php?action=getByCountyCode&data=033
demo: /api.php?action=getByCountyCode&data=033&country=us

function: getByPostalCode
Get result by a postal code. 
action: getByPostalCode 
data: postal code 
country: country abbreviation of 2 letters
usage: /api.php?action=getByPostalCode&data=75287
demo: /api.php?action=getByPostalCode&data=75287&country=us

function: getNearbyByPostalCode
Get nearby postal codes by another postal code and mile distance. The distance is default to 5 mile. 
action: getNearbyByPostalCode 
data: zip code or zip code, distance 
country: country abbreviation of 2 letters
usage: /api.php?action=getNearbyByPostalCode&data=75287
usage: /api.php?action=getNearbyByPostalCode&data=75287,20
demo: /api.php?action=getNearbyByPostalCode&data=75287&country=us
demo: /api.php?action=getNearbyByPostalCode&data=75287,20&country=us

PHP Code Integration

For more information on how to use the PostalCodeKit PHP class, please refer to the postal_code_demo.php file in your purchased package.

// Initial PDO
$dbh = new PDO("mysql:host=127.0.0.1;dbname=postal_codes", "db_user", "db_password", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8';"));

// Initial PostalCodeKit class
$postalCodeKit = new PostalCodeKit($dbh, 'postal_codes_table', 'US');

// Start calling functions
$results = $postalCodeKit->searchByCity("New York");

Buy it now at CodeCanyon.

Credits

Geonames.org – Creative Commons Attribution 3.0