Revision 19 as of 2008-12-20 15:23:48

Clear message

<?php

$video_id = $_GET['v'];

function processURL($url){if(function_exists ("curl_init")){$ch = curl_init (); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_TIMEOUT, 10); curl_setopt ($ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $xml = curl_exec ($ch);curl_close ($ch);}else{$xml = file_get_contents ($url);}return ($xml);}

function get_vid ($_a, $max){ $rssstring = processURL ("http://gdata.youtube.com/feeds/videos?vq=".$_a."&start-index=1&max-results=".$max.""); preg_match_all ("#<entry>(.*?)</entry>#s", $rssstring, $items);$n = count ($items[0]); for ($i=0; $i<$n; $i++){$rsstemp = $items[0][$i]; preg_match_all("#<media:player url='(.*?)'/>#s",$rsstemp,$ids);$ids[1][0]=str_replace("http://www.youtube.com/watch?v=","",$ids[1][0]);$out[$i]['id']= $ids[1][0];preg_match_all("#<title type='text'>(.*?)</title>#s",$rsstemp,$titles);$out[$i]['title']= $titles[1][0]; preg_match_all("#<media:thumbnail url='(.*?)'(.*?)/>#s",$rsstemp,$thumbs); $out[$i]['thumb']= $thumbs[1][0];} return $out;}

function youtube_t ($_ID){global $_text; $rssstring = processURL("http://gdata.youtube.com/feeds/videos/".$_ID.""); preg_match_all("#<title type='text'>(.*?)</title>#s",$rssstring,$titles); preg_match_all("#<media:keywords>(.*?)</media:keywords>#s",$rssstring,$tags); preg_match_all("#<yt:duration seconds='(.*?)'/>#s",$rssstring,$mtimes); preg_match_all("#<media:description type='plain'>(.*?)</media:description>#s",$rssstring,$_desc);

?>

<h2><? echo ".$_out[$i]['title']." ?></h2>

<div id="placeholder1"></div>

<?php } ?>

Unable to edit the page? See the FrontPage for instructions.