mercredi 3 mai 2017

Google Maps API with Laravel Timeout Issues

I am using laravel to storing the place information. In that i am post the address of a location or place then convert the address into latitude and longitude. I have tried the following code in my localhost,

$geo = file_get_contents('http://ift.tt/1dMgVj6'.urlencode($postData['building_address']).'&sensor=false');

    $geo = json_decode($geo, true);

     if ($geo['status'] = 'OK') {
        $latitude = $geo['results'][0]['geometry']['location']['lat'];
        $longitude = $geo['results'][0]['geometry']['location']['lng'];
        $points = array('lat'=> $latitude ,'lng'=>$longitude);
    } 

While i am print the $points variable it will shows the latitude and longitude.

But i move this code into my live server means it throws the following errors.

ErrorException in BuildingController.php line 78: file_get_contents(http://ift.tt/2pF5rH6): failed to open stream: Connection timed out

Please Help me to solve this issues.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire