当我尝试使用 API 并模拟不同的位置时,我收到了 REQUEST_DENIED 错误。API 文档中的示例参数有效,但是当我使用不同的经纬度坐标时,它会以 REQUEST_DENIED 的形式反弹。大约一周前它还在工作。请问我能做什么?
php中的代码:
......////
$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);