【发布时间】:2018-07-03 04:28:16
【问题描述】:
我正在使用 PHP cURL 来使用我的 Google API 密钥检索 Google 地点信息,但每当我放置任何 http 引荐来源网址时都会出错。请问有什么办法吗?
{
"error_message" : "API keys with referer restrictions cannot be used with this API.",
"html_attributions" : [],
"status" : "REQUEST_DENIED"
}
我的 HTTP 引荐来源网址
*mywebsite.local:8080*
*.mywebsite.local:8080*
*www.mywebsite.local:8080*
mywebsite.local:8080*
www.mywebsite.local:8080*
http://www.mywebsite.local:8080*
http://mywebsite.local:8080*
我的代码
$url = 'https://maps.googleapis.com/maps/api/place/details/json?placeid=" . $place_id . "&key=SECRET_KEY;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$json = curl_exec($ch);
curl_close($ch);
关于信息我不能使用服务器引用,因为我的网站使用动态 ip。
对我有什么建议吗?
【问题讨论】:
标签: php curl google-api