PHP Classes

PHP YouTube API Class: Search or retrieve YouTube video information

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 302 This week: 1All time: 7,392 This week: 571Up
Version License PHP version Categories
youtube-v3 1Free For Educatio...5.0PHP 5, Web services, Video
Description 

Author

This class can search or retrieve YouTube video information.

It can send HTTP requests to the YouTube API v3 to perform searches for videos with a given keyword.

The class can query about a specific video and retrieve the title, description, duration and thumbnail.

Picture of Osama Salama
  Performance   Level  
Name: Osama Salama <contact>
Classes: 5 packages by
Country: Egypt Egypt
Age: 38
All time rank: 149112 in Egypt Egypt
Week rank: 103 Up1 in Egypt Egypt Up

Example

<?php

/*

Search in YouTube using Api . v3

*/

require_once "YouTube.php";
$Video = new YouTube();
 
$result = $Video->Search('phpclasses');

echo
"<table width=\"300px\">
<th>VideoID</th>
<th>Title</th>
<th>description</th>
<th>thumbnails</th>
"
;
     if(
is_array($result)){

  for(
$i=0;$i<count($result['items']);$i++){
 
?>
<tr>
<td><?php echo $result['items'][$i]['id']['videoId'];?></td>
<td><?php echo $result['items'][$i]['snippet']['title'];?></td>
<td><?php echo $result['items'][$i]['snippet']['description'];?></td>
<td><img src="<?php echo $result['items'][$i]['snippet']['thumbnails']['default']['url'];?>"/></td>
</tr>
 
<?php


    
}
echo
"</table>";
      }


  Files folder image Files  
File Role Description
Accessible without login Plain text file example1.php Example example 1
Accessible without login Plain text file example2.php Example example 2
Plain text file YouTube.php Class YouTubeClass

 Version Control Unique User Downloads Download Rankings  
 0%
Total:302
This week:1
All time:7,392
This week:571Up