如何使用YouTube数据API的WAMP服务器 [英] How to use youtube data api in wamp server
问题描述
我已经下载谷歌API的PHP客户端并提取谷歌文件夹到WAMP服务器的根目录。
有关访问YouTube上的搜索功能,我使用的的search.php 此的 GitHub库。为了创建API密钥我跟了这教程。
在第5步中,我选择公开的API访问权限选项,并在创建新的键我选择的窗口的浏览器键选项。
由于我使用的是本地主机系统(WAMP服务器),我用这个地址的http://本地主机/
创建我的应用程序。新创建的API密钥与在 $ Developer_Key开发
的的search.php REPLACE_ME取代。
我打开的search.php在我的本地主机和搜索关键字的人真棒的但它显示这个错误。
出现了一个客户端错误:HTTP错误:
无法连接: 'fopen(com$p$pss.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>]:未能打开流:操作失败
EDITED
由于我试图解决我的问题,我已搜查在浏览器警告的URL(实际键),这表明低于误差
<$p$p><$c$c>https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&q=people+are+awesome&maxResults=25&key=forsecurityreasonsapikeyisremoved
块引用>{
错误:{
错误:
{
域:usageLimits
原因:dailyLimitExceededUnreg
消息:用于未日常使用超出限制继续使用,需要注册。
extendedHelp:HTTPS://$c$c.google.com/apis/console
}
]
code:403,
消息:用于未日常使用超出限制继续使用,需要注册。
}
}看来YouTube API取得不工作的其他谷歌产品的API正在
<$p$p><$c$c>www.googleapis.com/books/v1/volumes?q=Henry+David+Thoreau&filter=free-ebooks&key=forsecurityreasonsapike
上面的链接工作
解决方案您可以先检查你的
的php.ini
文件中有此设置设置为on于allow_url_fopen =开
编辑使用wampmanager菜单链接,以确保您正在编辑的正确的php.ini文件,像这样php.ini文件:
wampmanager - &GT; PHP - &GT; php.ini中
I have downloaded google-api-php-client and extracted the google folder into the root of wamp server.
For accessing search function of youtube I have used search.php from this github repo. In order to create API key I have followed this tutorial.
In step 5 I selected Public API access option and in create new key window I selected Browser key option.
As I am using a localhost system (wamp server), I used this address
http://localhost/
for creating my app. The newly created API key was replaced with REPLACE_ME in the$DEVELOPER_KEY
of search.php.I opened the search.php in my local host and searched for keyword people are awesome but its showing this error.
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
As i am trying to solve my problem, i have searched the url in the warning in a browser (with actual key ) and it showed below error
https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&q=people+are+awesome&maxResults=25&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." } }
it seems youtube api is not working other google products api is working
www.googleapis.com/books/v1/volumes?q=Henry+David+Thoreau&filter=free-ebooks&key=forsecurityreasonsapike
the above link worked
解决方案You could first check that your
php.ini
file has this setting set to onallow_url_fopen = On
Edit your php.ini file using the wampmanager menu links to ensure you are editing the correct php.ini file, like so :
wampmanager -> PHP -> php.ini
这篇关于如何使用YouTube数据API的WAMP服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!