google map api附近搜索如何从半径检查

时间:2014-02-12 03:18:16

标签: google-maps google-maps-api-3

我正在使用此代码进行附近的搜索,我有问题,如何获得结果?

results = 0然后,我想检查radius = 1到1000,results = 1然后我想getAddress我是怎么做到的?

function getAddress($la, $lo){
  $ur= "http://maps.googleapis.com/maps/api/place/nearbysearch/json?location=".$la.",".$lo."&radius=10&sensor=true&key=AIzaSyA0JD_Z2Uo2AfnDTejQFWHAXOIaRRpjF8c";
   $json = file_get_contents($ur);

   $data = json_decode($json);
   $status = $data->status;
   $name= '';
     if($status == "OK"){
      $addr = $data->results[0]->formatted_address;
     }
   return $addr;
  } 
          echo getAddress("6.154841","80.700845");

0 个答案:

没有答案