Jump to content

[SOLVED] JSON not working on LAMP


shah_ankitb

Recommended Posts

$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address=ahmedabad&sensor=false'); $output= json_decode($geocode); var_dump(json_decode($geocode, true)); echo $lat = $output->results[0]->geometry->location->lat; echo $long = $output->results[0]->geometry->location->lng; when i print it returns NULL instead of data. Reference URL :- http://www.achari.in/how-to-get-longitude-...-geocoding-json it may be php.ini setting which i miss. when i run file from command prompt it display result "Latitude : 23.0395677Longitude : 72.5660045". But on browser in don't display any result Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution inini_set('allow_url_fopen', 1);ini_set('allow_url_include', 1); It's an issue of "allow_url_include" which is not enabled in PHP,ini

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...