当我上传带有zipcode的csv文件时,它将转换并保存纬度和逻辑.将zipcode转换为lat,lng时发生的错误.在我的localhost工作正常.当我在实时服务器上传时.我收到此错误警告:在第29行的/hermes/bosnaweb05a/b1410/ipg.rwdinfotechcom/vw/zipmapping/index.php中,allow_url_fopen = 0在服务器配置中禁用了file_get_contents():https://包装器.我也检查了我的谷歌API密钥.我无法添加php.ini文件.如果我上传php.ini文件,则显示内部服务器错误.
Here my code
function getLnt($zip){
$url = "https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyDEGgYDar8y3Bx-1FpY3hq6ON4LufoRK60&address=
".urlencode($zip)."&sensor=false";
$result_string = file_get_contents($url);
$result = json_decode($result_string, true);
$result1[]=$result['results'][0];
$result2[]=$result1[0]['geometry'];
$result3[]=$result2[0]['location'];
return $result3[0];
}
Run Code Online (Sandbox Code Playgroud)
php ×1