| 
<?php$maxrecords=5;
 $keyword="rochakchauhan";
 require_once("YouTubeAPI.inc.php");
 $api=new YouTubeAPI($keyword,$maxrecords,1);
 $result=$api->getStreamingLinks();
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 <title>YouTube API :: Demo</title>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
 <meta name="keywords" content="Youtube,API,Demo,rochakchauhan" />
 <meta name="description" content="Demo of YouTube API" />
 <meta name="author" content="DMW Technologies" />
 <meta name="ROBOTS" content="index,nofollow" />
 <style type="text/css">
 body{ font-family: verdana; font-size: 12px;}
 a{ font-family:verdana; font-size:12px;text-decoration:none; color:#000000;}
 a:hover{font-family:verdana;font-size: 12px;text-decoration:underline; color: #FF0000;}
 .footer {text-align: center;}
 </style>
 </head>
 <body>
 <?php
 
 $maxrecords=5;
 $keyword="rochakchauhan";
 if (isset($_GET['keyword']) && trim($_GET['keyword'])!="") {
 $keyword=$_GET['keyword'];
 $keyword=urlencode($keyword);
 }
 if (isset($_GET['maxrecords']) && trim($_GET['maxrecords'])!="") {
 $maxrecords=$_GET['maxrecords'];
 }
 ?>
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"><div>Search:<input type="text" name="keyword" value="<?=urldecode($keyword)?>"/> Records:<select name="maxrecords">
 <?php
 for ($i=1;$i<5;$i++){
 $j=$i*5;
 if ($maxrecords == $j) {
 echo "<option value='$j' selected='selected'>$j</option>";
 }
 else {
 echo "<option value='$j'>$j</option>";
 }
 }
 ?>
 </select> <input type="submit" name="submit" value="Search" /></div><div> </div></form>
 <?php
 require_once("YouTubeAPI.inc.php");
 $api=new YouTubeAPI($keyword,$maxrecords,1);
 $result=$api->getStreamingLinks();
 
 
 //use the below code to get the donload link from the youtube url
 $downloadInfo=$api->getDownloadLink("http://www.youtube.com/watch?v=5WDlUPPnBAE");
 
 $total=count($result);
 for ($i=0;$i<$total;$i++){
 $mobileUrl=$flvUrl="#";
 $imageSrc=$result[$i]['thumbnailUrl'];
 $title=$result[$i]['title'];
 if (isset($result[$i]['flvurl'])) {
 $flvUrl=$result[$i]['flvurl'];
 }
 if (isset($result[$i]['mobileurl'])) {
 $mobileUrl=$result[$i]['mobileurl'];
 }
 
 echo "<div>$title<br /><img src='$imageSrc' alt='$title' /><br /><a href='$flvUrl'>Stream on PC</a><br /><a href='$mobileUrl'>Stream on Mobile</a></div><div> </div>";
 }
 ?>
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"><div>Search:<input type="text" name="keyword"  value="<?=urldecode($keyword)?>" /> Records:<select name="maxrecords">
 <?php
 for ($i=1;$i<5;$i++){
 $j=$i*5;
 if ($maxrecords == $j) {
 echo "<option value='$j' selected='selected'>$j</option>";
 }
 else {
 echo "<option value='$j'>$j</option>";
 }
 }
 ?>
 </select> <input type="submit" name="submit" value="Search" /></div><div> </div></form>
 <div class="footer">Powered by <a href="http://www.dmwtechnologies.com">DMW Technologies (P) Limited</a></div>
 </body>
 </html>
 |