Monday, October 29, 2012

Get YouTube Video Comments Using PHP

[sourcecode language="php"]
// video id
$videoId='';
// url where feed is located
$url="http://gdata.youtube.com/feeds/api/videos/{$videoId}/comments";
// get the feed
$comments=simplexml_load_file($url);
// parse the feed using a loop
foreach($comments->entry as $comment)
{
echo '<fieldset>'.$comment->content.'</fieldset>';
}
[/sourcecode]

No comments:

Post a Comment

How to enable CORS in Laravel 5

https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...