发生Youtube API v3客户端错误:HTTP错误:无法连接无法打开流

时间:2016-03-27 10:16:10

标签: php youtube-api fopen youtube-data-api

我正在使用youtube api v3,但当我尝试使用此搜索任何内容时,它会给我错误。

  An client error occurred: HTTP Error: Unable to connect: 'fopen(compress.zlib://https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&amp;q=national+songs&amp;maxResults=20&amp;type=video&amp;key=AIxxxxxxxxxxxxxxxxxx7anA) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: operation failed'  

我检查了我的wamp服务器中的php.ini个文件,这些文件是允许的fopen url allow_url_fopen = on

这是简单的搜索代码。

<?php
require_once 'Google/autoload.php';
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';
  $DEVELOPER_KEY = 'AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxa7anA';

  $client = new Google_Client();
  $client->setDeveloperKey($DEVELOPER_KEY);
  // Define an object that will be used to make all API requests.
  $youtube = new Google_Service_YouTube($client);

  try {
    // Call the search.list method to retrieve results matching the specified
    // query term.
    $searchResponse = $youtube->search->listSearch('id,snippet', array(
      'q' => $_GET['q'],
      'maxResults' => 20,
      'type' => 'video',
    ));
     .......
     .......  

当我尝试仅运行此https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&amp;q=national+songs&amp;maxResults=20&amp;type=video&amp;key=AIzaxxxxxxxxxxxxxxxxxxxxx7anA时 它会显示这一点。

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceededUnreg",
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
    "extendedHelp": "https://code.google.com/apis/console"
   }
  ],
  "code": 403,
  "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
 }
}

我在console api检查了每日配额限制,但这里没问题。它没有显示超出限制的任何内容 我还用其他电子邮件创建了新的api密钥但是同样的错误 为什么会出现这种错误请帮帮我 感谢。

0 个答案:

没有答案