【发布时间】:2015-09-27 11:52:06
【问题描述】:
我使用了这个代码...
$youtube_url = json_decode( file_get_contents( 'http://gdata.youtube.com/feeds/api/users/channelname?v=2&alt=json' ), true );
$youtube_data = $youtube_url['entry']['yt$statistics']['subscriberCount'];
...但是有一个错误:
“警告:file_get_contents(http://gdata.youtube.com/feeds/api/users/nikitaplay?v=2&alt=json) [function.file-get-contents]: 无法打开流:HTTP 请求失败!HTTP/1.0 410 Gone in...”
我PHP不好,所以我不明白这个错误
更新: 我也使用了这段代码...
$youtube_url = json_decode( file_get_contents( 'https://www.googleapis.com/youtube/v3/channels?part=statistics&id=d1chArLU0voGrMzbUM4G-A&key=AIzaSyCwAooaPaSzPEcDBULe-7jI3XZ6ZYRmiNY' ), true );
...但是有一个错误:
警告:file_get_contents(https://www.googleapis.com/youtube/v3/channels?part=statistics&id=d1chArLU0voGrMzbUM4G-A&key=AIzaSyCwAooaPaSzPEcDBULe-7jI3XZ6ZYRmiNY) [function.file-get-contents]:打开流失败:HTTP 请求失败! HTTP/1.0 403 Forbidden in...
【问题讨论】:
-
您好,欢迎来到 SO,请花点时间阅读Tour。由于您现在的问题是,它缺乏很多信息,包括出了什么问题,以及您遇到了什么错误,只是说“它不起作用”并不能告诉我们太多。因此,请尽可能多地为问题提供有用的信息来更新您的问题:)
-
API v2 不再可用,使用 API v3
-
mpgn,我知道,这就是我问这个问题的原因
标签: php youtube youtube-api