Google maps Google Places API请求被拒绝(使用有效的API密钥)
当我尝试使用API并模拟不同的位置时,我收到请求被拒绝的错误。API文档中的示例参数可以工作,但当我使用不同的Lat和Long坐标时,它会在请求被拒绝时反弹。大约一周前还在工作。请问我能做什么 php代码: ////Google maps Google Places API请求被拒绝(使用有效的API密钥),google-maps,google-places-api,Google Maps,Google Places Api,当我尝试使用API并模拟不同的位置时,我收到请求被拒绝的错误。API文档中的示例参数可以工作,但当我使用不同的Lat和Long坐标时,它会在请求被拒绝时反弹。大约一周前还在工作。请问我能做什么 php代码: //// $url = "https://maps.googleapis.com/maps/api/place/search/json?location=".$latitude.", ".$longitude."&
$url = "https://maps.googleapis.com/maps/api/place/search/json?location=".$latitude.",
".$longitude."&radius=100&sensor=false&key=".$key."";
// Open the Curl session
$session = curl_init($url);
// If it's a POST, put the POST data in the body
//if ($_POST['path']) {
$postvars = '';
while ($element = current($_GET)) {
$postvars .= urlencode(key($_GET)).'='.urlencode($element).'&';
next($_GET);
}
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
//}
// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
//curl_setopt($session, CURLOPT_USERPWD, $username.':'.urldecode($password));
// Make the call
$json = curl_exec($session);
你能告诉我们你是如何在代码中使用这个键的吗?嗨,昆玛,我现在已经添加了php代码。请看一看