views:

265

answers:

2

I want to build a json_encoded list of all restaurants nearby a point using PHP

looking to build a php function which takes Parameters: Latitude,longitude,radius (in meters). And return a json_encoded list

I have a API key and I work with js but I wat it done with server-side scripting php

dose any one know how to do it.


I want to store the list to my database.

found this but got some problem http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#Search

what is the mapID and the userID in the url given there.

A: 

Have you thought of using Ajax to submit the data to the PHP script and use the return value of the PHP script in javascript to plot the data to the map. You can json to send over the data.

Kolky
A: 

Take a look at the Geocoding API: http://code.google.com/apis/maps/documentation/geocoding/. You can invoke the API from PHP with the file_get_contents function:

$url = sprintf("http://maps.google.com/maps/geo?q=%s&output=json&key=%s&ll=%s,%s",
        $query, $api_key, $latitude, $longitude);
$data = json_decode(file_get_contents($url));
CodeAddict
how to add radius and search for restaurants.
goutham
The radius can be specified by passing the 'spn' parameter (see Viewport Biasing in the API doc). I don't know how to search for restaurants with geocode.
CodeAddict