错误“此API项目未被授权使用此API” - 尝试获取lat,lng基于地址

时间:2016-02-02 04:13:26

标签: google-maps curl google-maps-api-3 google-geocoding-api

我有

$url = https://maps.googleapis.com/maps/api/geocode/json?address=111+Park+AveFloor+4New+York%2CNY%2C10022%2CUSA&key=***

我试过

让卷曲得到我的lat,lng

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT_MS, 1000);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_VERBOSE, TRUE);

    $result = curl_exec($ch);
    $info = curl_getinfo($ch);
    // dd($info);

    curl_close($ch);
    $result =  json_decode($result, true);
    return $result;

Google Developer Console

enter image description here

看起来我启用的东西比我应该的多,但是当我的卷曲响应一直显示

CURL结果

array:3 [▼
  "error_message" => "This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console"
  "results" => []
  "status" => "REQUEST_DENIED"
]

好奇......?

我忘了/做错了什么?

0 个答案:

没有答案