我想从此JSON文件中获取订阅者计数值:http://gdata.youtube.com/feeds/api/users/googlechrome?v=2&alt=json
这就是我所做的,但它不起作用 .
$youtube_url = json_decode( file_get_contents( 'http://gdata.youtube.com/feeds/api/users/googlechrome?v=2&alt=json' ), true );
$youtube_data = $youtube_url['entry']['yt$statistics']['subscriberCount'];
2 回答
PHP代码:
用法示例:PHP代码:
我只是将JSON方法更改为XML,一切正常 . 我写的这个问题对@Matt Koskela有好处,但不适合我 . 无论如何,我将使用这种方法,但我真的想知道JSON方法的问题 .