5

I am trying to accomplish a two step task on the server side using Google Map API v3 rather than on the client side but have not found much documentation as to how to accomplish this. So I was wondering if anyone here can help or guide me in the right direction.

The 1st step is getting the geo-code location of an address using PHP. I think I have figured this out and that is by making a curl call to http://maps.google.com/maps/api/geocode/json?sensor=false&address= and processing the JSON response. Once I have the geo-codes, I store them in my database.

The 2nd step is finding random addresses in a specific radius of the address in 1st step. This I cannot seem to find how to do in the server side.

Any help or guidance would be truly appreciated.

1
  • 1
    For completeness: using Google data requires showing it on a Google map. You can't simply suck out their data for your own purposes. I'm sure this question relates to the preliminaries to showing a map; but as it doesn't actually mention a map, it's as well to be explicit. Commented Apr 25, 2012 at 16:10

1 Answer 1

4
  1. Easiest way

    $url = 'http://maps.google.com/maps/api/geocode/json?sensor=false&address=' . urlencode($address);     
    $data = json_decode(file_get_contents($url), true); // insert in the database
    
  2. Searching with the given radius and center point (lat, lng): https://developers.google.com/maps/articles/phpsqlsearch

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.