curl - Google Geocoding API suddenly very slow -
i working on site month ago calls google's geocoder , returned results instantly. when attempt call, takes 8 seconds. having problems service being slow?
i'm using php , curl grab information, instance:
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=1295 federal avenue, los angeles, ca&sensor=false"; $ch = curl_init($url); curl_setopt($ch, curlopt_returntransfer, 1); $parsed = curl_exec($ch); curl_close($ch); print_r($parsed);
results returning fine, takes long. also, if use same code other api provider, results come instantaneously again, means slowdown not on server's side.
thanks suggestions.
1) obtain api key google.
2) consider using file_get_contents instead of curl.
3) general hint: use urlencode address-variable.
Comments
Post a Comment