flv.php
<?php
if (isset($_GET['id']))
{
function g_page ($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_VERBOSE, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curl);
// check for errors
if (curl_errno($curl))
{
trigger_error('CURL error: "' . curl_error($curl) . '"', E_USER_WARNING);
$output = false;
}
curl_close($curl);
return $output;
}
function youtube_t ($url)
{
$page = g_page($url);
if ($page === false) die('Youtube down?');
preg_match('/"video_id": "(.*?)"/', $page, $match);
$var_id = $match[1];
preg_match('/"t": "(.*?)"/', $page, $match);
$var_t = $match[1];
$url = '';
$url .= $var_id;
$url .= '&t=';
$url .= $var_t;
$url = 'http://www.youtube.com/get_video?video_id='.$url;
return $url;
}
echo youtube_t('http://www.youtube.com/watch?v='.$_GET['id']);
}
else
{
echo 'HATA!..<br />flv.php?id=t_HHhG8uLbc şeklinde calistirin..';
}
?>