function getGeoCoords($address)
{
$coords = array();
$address = utf8_encode($address);
$geoCodeURL = "https://maps.google.com/maps/api/geocode/json?address=".
urlencode($address)."&sensor=false&key=ApiKey(AIzaSyDaepez9PYv_74hAv34spbNfeWOo26OhgM)";
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $geoCodeURL);
$result = curl_exec ($curl);
var_dump($result);
}
你好朋友,当我运行上面的查询时,它执行“bool(false)bool(false)bool(false)bool(false)bool(false)”,我已经尝试了一切,但没有任何帮助,请帮助我们,
答案 0 :(得分:1)
瞥了一眼,我看到的第一件事就是ApiKey
,试着直接把它作为
key=AIzaSyDaepez9PYv_74hAv34spbNfeWOo26OhgM
$ geoCodeURL变量应该像这样分配:
$geoCodeURL = "https://maps.google.com/maps/api/geocode/json?address=" .
urlencode($address) . "&sensor=false&key=AIzaSyDaepez9PYv_74hAv34spbNfeWOo26OhgM";
干杯