I just replaced file_get_contents() to curl code as that is running very slow. But after curl too is slow. Can anyone please tell me anything wrong with my code?
$myurl = "http://maps.google.com/maps/geo?q=" . urlencode($address) . "&output=xml&key=MY API KEY";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $myurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$mydata= curl_exec($ch);
curl_close($ch);
echo $mydata;
The code works for first time of page load but not second by refreshing once or twice.