当我尝试使用API并模拟不同的位置时,我收到REQUEST_DENIED错误。 API文档中的示例参数有效但当我使用不同的Lat和Long coord时,它会以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);