文件\u获取\u内容无法打开流:HTTP请求失败!HTTP/1.0 403禁止使用php
“有时”我会出错 文件获取内容(): 无法打开流:HTTP请求失败!HTTP/1.0 403禁止 我的php文件\u获取\u内容无法打开流:HTTP请求失败!HTTP/1.0 403禁止使用php,php,google-api,google-books,Php,Google Api,Google Books,“有时”我会出错 文件获取内容(): 无法打开流:HTTP请求失败!HTTP/1.0 403禁止 我的php <?php header("Access-Control-Allow-Origin: *"); header('Access-Control-Allow-Headers: X-Requested-With'); header('Access-Control-Allow-Methods: POST, GET, OPTIONS'); $postdata = file_ge
<?php
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Headers: X-Requested-With');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
$postdata = file_get_contents("php://input");
//isset($postdata) {
//$request = ($postdata);
$isbn = $_GET['isbn'];
$path = "https://www.googleapis.com/books/v1/volumes?q=isbn:".$isbn."";
$jsondata = file_get_contents($path);
$jsons = json_decode($jsondata,true);
echo json_encode($jsons);
?>
可能是因为您在一天或一小时内超出了访问限制或类似限制。是的,如果短时间内来自同一IP地址的请求过多,就会发生这种情况。您需要在Google注册一个帐户,获取API的API密钥(服务器密钥),并在每个请求中发送该密钥。如何解决此问题?@ARR.s正如我所说,您需要一个apikey,然后如果您拥有该密钥(例如abcde),请将其添加到URL中,如下所示: