I found this code snippet to retrieve the title from a YouTube video and it works,
<?php
$video_id = 'y8Kyi0WNg40';
$content = file_get_contents("http://youtube.com/get_video_info?video_id=" . $video_id);
parse_str($content, $ytarr);
echo $ytarr['title'];
?>
however many people say that this method is not safe for some reason and they should use cURL with YouTube's API, can you please explain why this method(file_get_contents
) is not safe.
And if so I will appreciate a link to a tutorial or example on using cURL to achieve the same results as the code above.