私はこの答えに従おうとしていました:
https://stackoverflow.com/a/3331372/1063287
したがって、私のphpドキュメントには、以下の変数がありました。
$json = file_get_contents("https://gdata.youtube.com/feeds/api/videos/{$video_id}?v=2&alt=json");
$json_data = json_decode($json);
$video_title = $json_data->{'entry'}->{'title'};
$video_date = $json_data->{'entry'}->{'published'};
$video_duration = $json_data->{'entry'}->{'media:group'}->{'yt$duration'};
$video_views = $json_data->{'entry'}->{'yt$statistics'}->{'viewCount'};
$video_description = $json_data->{'entry'}->{'content'};
しかし、それは私にエラーを与えました:
警告: file_get_contents() [function.file-get-contents]: 12 行目の /home/path/to//file.php のサーバー構成で URL ファイル アクセスが無効になっています
警告: file_get_contents( https://gdata.youtube.com/feeds/api/videos/xx-xxxxxxx?v=2&alt=json ) [function.file-get-contents]: ストリームを開くことができませんでした: 適切なラッパーがありません/home/path/to/file.php の 12 行目にあります
ここで開発者ガイドを見てきました:
https://developers.google.com/youtube/2.0/developers_guide_php
ここでフィードとエントリの構造を理解できます。
いくつかの解決策(curlを含むもの)を見つけましたが、それらは機能していないか、使用するのに最適な方法であるかどうかわかりませんでした.
上記のコードに何か問題があるかどうか、誰か教えてもらえますか?