这是我显示YouTube视频详细信息的代码,但它不起作用。网页为空白。这是代码:
<?php
$json_output = file_get_contents("http://gdata.youtube.com/feeds/api/videos/aNgnkIvLdpU?v=2&alt=json");
$json = json_decode($json_output, true);
//This gives you the video description
$video_description = $json['entry']['media$group']['media$description']['$t'];
//This gives you the video views count
$view_count = $json['entry']['yt$statistics']['viewCount'];
//This gives you the video title
$video_title = $json['entry']['title']['$t'];
echo $video_title;
echo $view_count;
echo $video_description;
?>
此 URL 不起作用:
Warning: file_get_contents(http://gdata.youtube.com/feeds/api/videos/aNgnkIvLdpU?v=2&alt=json): failed to open stream: HTTP request failed! HTTP/1.0 410 Gone