2014-09-23 77 views
0

我已经下载google-api-php-client和提取的谷歌文件夹放到WAMP服务器的根目录。如何使用YouTube数据API在WAMP服务器

对于访问YouTube的搜索功能,我已经使用search.php从这个github repo。为了创建API密钥,我按照这个tutorial

在步骤5中,我选择公共API访问选项,并在创建我选择浏览器键选择新的密钥窗口。

由于我使用本地主机系统(WAMP服务器),我用这个地址http://localhost/创建我的应用程序。新创建的API密钥在$DEVELOPER_KEY的search.php与REPLACE_ME取代。

我在我的本地主机中打开了search.php并搜索了关键字人们很棒但它显示了这个错误。

An client error occurred: HTTP Error: 
    Unable to connect: 'fopen(compress.zlib://https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&q=people+are+awesome&maxResults=25&key=forsecurityreasonsapikeyisremoved) 
    [<a href='function.fopen'>function.fopen</a>]: failed to open stream: operation failed' 

EDITED

,因为我试图解决我的问题,我已搜查在浏览器警告的URL(实际键),它显示在下面的错误

https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&amp;q=people+are+awesome&amp;maxResults=25&amp;key=forsecurityreasonsapikeyisremoved 
{ 
"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." 
} 
} 

看来youtube api不工作ot她的Google产品的API工作

www.googleapis.com/books/v1/volumes?q=Henry+David+Thoreau&amp;filter=free-ebooks&amp;key=forsecurityreasonsapike 

上面的链接工作

回答

0

你可以先检查你的php.ini文件有此设置设置为开

allow_url_fopen = On 

编辑使用您的php.ini文件wampmanager菜单链接,以确保您正在编辑正确的php.ini文件,如下所示:

wampmanager -> PHP -> php.ini 
+0

allow_url_fopen打开 – Eka 2014-09-23 09:56:40