I manage a website for a client who had a php based search using API v2 to 
find people in a given search radius based on postal/zipcode. Since API v2 
doesn't work anymore, I'm not sure how to transition this search over to 
v3. The original requested results in csv format, which is no longer 
supported, to search a MySQL database. Now all it returns is "url not 
loading".
 
Here's the code that's causing me problems:
 
$base_url = "http://maps.google.com/maps/geo?output=csv&key=".$apikey;
  $request_url = $base_url . "&q=" . urlencode($zip);
  $csv = file_get_contents($request_url) or die("url not loading");
  $csvSplit = split(",", $csv);
  $status = $csvSplit[0];
    if (strcmp($status, "200") == 0) {
       // Successful geocode
       $geocode_pending = false;
       $latitude = $csvSplit[2];
       $longitude = $csvSplit[3];
  }
  
  if($latitude != 0 && $longitude != 0){
   
   $zip_radius = mysql_db_query($dbName,"SELECT DISTINCT 
service_areas.instructor_id, round((acos((sin($latitude/57.2958) * 
sin(lat/57.2958)) + (cos($latitude/57.2958) * cos(lat/57.2958) * 
cos(lng/57.2958 - $longitude/57.2958)))) * 3963) AS distance FROM 
service_area_codes,service_areas,instructors WHERE 
service_area_codes.area_id = service_areas.id and 
service_areas.instructor_id = instructors.id and instructors.enabled = 1 
and ((lat >= $latitude - ($radius/111)) AND (lat <= $latitude + 
($radius/111)) AND (lng >= $longitude - ($radius/111)) AND (lng <= 
$longitude + ($radius/111))) group by service_areas.instructor_id ORDER BY 
distance ASC") or die(mysql_error());
 
Any ideas how I can get this working again?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to