How do I get the title of a youtube video if I have the Video Id?

后端 未结 9 1991
忘掉有多难
忘掉有多难 2020-12-13 00:28

I\'m playing now with the Youtube API and I began a small project (for fun).

The problem Is that I cant find the way to get Title of a video from the Id. (example: y

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 01:10

    My solution is:

    $xmlInfoVideo    = simplexml_load_file("http://gdata.youtube.com/feeds/api/videos/".$videoId."?v=2&fields=title");
    
    foreach($xmlInfoVideo->children() as $title) { $videoTitle = strtoupper((string) $title); }
    

    This get the title of the video.

提交回复
热议问题