I tried to answer this answer:
stack overflow
So, in my php document, I had the following variables:
$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'};
but this gave me an error:
Warning: file_get_contents () [function.file-get-contents]: URL file access is disabled in the server configuration in /home/path/to//file.php on line 12
Warning: file_get_contents ( https://gdata.youtube.com/feeds/api/videos/xx-xxxxxxx?v=2&alt=json ) [function.file-get-contents]: could not open the stream: no suitable shell can be found in /home/path/to/file.php on line 12
I looked at the developer guide here:
https://developers.google.com/youtube/2.0/developers_guide_php
and you can understand the feed and input structure here:
https://developers.google.com/youtube/2.0/developers_guide_protocol_understanding_video_feeds#Understanding_Video_Entries
and found several solutions (one of which is related to the twist), but they either did not work, or I did not know if they are the best method.
Can someone tell me if there is something wrong in the above code?
source share