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 All time: 7,395 This week: 524Up
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: 39
All time rank: 149212 in Egypt Egypt
Week rank: 195 Up2 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:0
All time:7,395
This week:524Up