ikky is web developer. She is implementing address book application in PHP programming language in which users updates their address and other users can see those contact addresses y entering user’s name. Here, she wants to validate address entered by users that address entered by user is actual or not. Validating address is difficult as we never have accurate address data of all over the world. There are many free as well as paid map apis available on internet such as Yahoo Place Finder, OpenAddresses, MapQuest, Google Maps API, OpenLayers, Microsoft Bing Maps etc.

Term “Reverse geocoding” is the process of converting geographic coordinates into a human-readable address. You can also get more idea about reverse geocoding from here. Google Maps Geocoding API is easy to use as it provides access reverse geocoding service via an HTTP request.

In this tutorial we will validate address entered by with google’s geocoding api.

Step – 1

Create simple HTML form which inputs address from user.

Here, we have taken two inputs from user. In address, User can enter his/her address with area name, area code, city, zip code, state and country.

Step – 2

Handle form request and validate address.

Full Code:


$json->results holds response from google maps api. Api provides Location details based on the input from including address1, address2, state, country, formatted address, geometry details such as bounds, longitudes and latitude, location type and place id.

place_id – Holds value of place
address_components – standard class object having details of address
formatted_address – Formatted address
geometry – provides geometry details of address such as bounds, latitude, longitude etc.
location_type – type of location Ex. APPROXIMATE


Suppose we have entered plain address “rajkot,india”. So, GeoCoding api will split input and provides exact address, city, state and country. It also provides other details such as latitude, longitude, Geo Location Area etc. We will use other details in next tutorials.

Read More

Get dropdown list of locations using Google Maps API

Integrate Google Prettify in Html page

  1. I simply want to tell you that I’m all new to blogs and truly liked you’re blog site. Very likely I’m likely to bookmark your site .You surely come with remarkable articles. Cheers for sharing your website page.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">