Atualizado em 14 dez 2009 17h17
Venda: Ssd Sata Wd Green 240gb - Para Notebook, Mini Pc - 2.5
Venda: Memoria Corsair 8gb (2 X 4gb) Ddr3 Notebook, Mini Pc
Venda: Injetor Poe Eap225 24v Passivo - Tl-poe2412g - Tp-link
Venda: Injetor Poe Ubiquiti 802.3at 48v 30w Gigabit U-poe-at
<?php
class youTube{
//---------------------------------------------------------------------------------------
// FUNÇÃO SUBSTITUTA FILE_GET_CONTENTS PARA HOSTS COM URL FILE-ACESS DISABLED
//---------------------------------------------------------------------------------------
function curlURL($url) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
$conteudo = curl_exec($ch);
curl_close($ch);
return $conteudo;
}
//---------------------------------------------------------------------------------------
// FUNÇÃO SUBSTITUTA GET_HEADERS PARA HOSTS COM URL FILE-ACESS DISABLED
//---------------------------------------------------------------------------------------
function _get_headers($url,$format=0, $user='', $pass='', $referer='') {
if (!empty($user)) {
$authentification = base64_encode($user.':'.$pass);
$authline = "Authorization: Basic $authentification
";
}
if (!empty($referer)) {
$refererline = "Referer: $referer
";
}
$url_info=parse_url($url);
$port = isset($url_info['port']) ? $url_info['port'] : 80;
$fp=fsockopen($url_info['host'], $port, $errno, $errstr, 30);
if($fp) {
$head = "GET ".@$url_info['path']."?".@$url_info['query']." HTTP/1.0
";
if (!empty($url_info['port'])) {
$head .= "Host: ".@$url_info['host'].":".$url_info['port']."
";
} else {
$head .= "Host: ".@$url_info['host']."
";
}
$head .= "Connection: Close
";
$head .= "Accept: */*
";
$head .= $refererline;
$head .= $authline;
$head .= "
";
fputs($fp, $head);
while(!feof($fp) or ($eoheader==true)) {
if($header=fgets($fp, 1024)) {
if ($header == "
") {
$eoheader = true;
break;
} else {
$header = trim($header);
}
if($format == 1) {
$key = array_shift(explode(':',$header));
if($key == $header) {
$headers[] = $header;
} else {
$headers[$key]=substr($header,strlen($key)+2);
}
unset($key);
} else {
$headers[] = $header;
}
}
}
return $headers;
} else {
return false;
}
}
function get_flv($v_id){
$conteudo = $this->curlURL("http://youtube.com/get_video_info?video_id=".$v_id);
parse_str($conteudo);
$url = "http://www.youtube.com/get_video.php?video_id=". $v_id ."&t=" . $token;
$cabecalhos = $this->_get_headers($url,1);
if(!is_array($cabecalhos['Location'])) {
$url = $cabecalhos['Location'];
} else {
foreach($cabecalhos['Location'] as $h){
if(strpos($h,"googlevideo.com")!=false){
$url = $h;
break;
}
}
}
return $url;
}
}
$FLV = new youTube;
$loc = $FLV->get_flv($_GET['v']);
header("Location: $loc");
?>
<?
echo ("<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="video.swf" width="569" height="360">
<!-- <![endif]-->
<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="569" height="360">
<param name="movie" value="video.swf" />
<param name="flashvars" value="file=playlist.php" />
<param name="allowscriptaccess" value="always" />
<param name="allowfullscreen" value="true" />
<!--><!--dgx-->
<param name="flashvars" value="file=playlist.php" />
<param name="allowscriptaccess" value="always" />
<param name="allowfullscreen" value="true" />
</object>
<!-- <![endif]-->");
?>
<?
echo ("<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>Seu Site - VIDEOS - PLAYLIST</title>
<info>http://www.seusite.com</info><tracklist>");
echo ("<track>
<location>fix.php?v=3CjD2gd8Jho</location>
<meta rel="type">flv</meta>
</track>");
echo ("</tracklist></playlist>");
?>
<?
echo ("<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>PARACATU.NET - VIDEOS - PLAYLIST</title>
<info>http://www.paracatu.net</info><tracklist>");
// Video 1
echo ("<track>
<location>fix.php?v=3CjD2gd8Jho</location>
<meta rel="type">flv</meta>
</track>");
// Video 2
echo ("<track>
<location>fix.php?v=3CjD2gd8Jho</location>
<meta rel="type">flv</meta>
</track>");
echo ("</tracklist></playlist>");
?>
CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
fix_fmt.php?v=LnhMLYQl2Rk&fmt=22
© MNDTI - Tecnologia e Informação. Todos Direitos Reservados. Política de privacidade.