Google API Key Http引荐来源问题

时间:2016-02-04 08:56:44

标签: php google-api google-books

我正在使用PHP cURL使用我的Google API密钥检索Google图书信息,但每当我放置任何http引荐来源时都会收到ipRefererBlocked错误。好吗?

HTTP引荐

  

http://mylibrarymanager.com/*
  https://mylibrarymanager.com/*
  http://www.mylibrarymanager.com/*
  https://www.mylibrarymanager.com/*
  www.mylibrarymanager.com / *

代码

$url = 'https://www.googleapis.com/books/v1/volumes?q=isbn:9788420636641&projection=lite&maxResults=1&printType=books&key='.$myApiKey;
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$json = curl_exec($ch); 
curl_close($ch); 

1 个答案:

答案 0 :(得分:1)

由于您是从服务器端PHP脚本调用API,因此您应该use a server API key而不是浏览器API密钥。