Merhaba;
<?php
error_reporting(0);
ob_start();
$url = $_GET['v'];
$ref = 'referer';
$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_REFERER,$ref);
curl_setopt($ch,CURLOPT_PROXY,'xxx.xxx.232.69');
curl_setopt($ch,CURLOPT_PROXYPORT,'80');
curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
$data = curl_exec($ch);
$length = strlen($data);
header('Last-Modified: '.date('r'));
header('Accept-Ranges: bytes');
header('Content-Length: '.$length);
header('Content-Type: image/jpeg');
print($data);
ob_end_flush();
curl_close($ch);
?>
ben bu kod ile örneğin "/proxy.php?v=www.youtube.com/watch?v=69UeYKjxoE8" sayfasına girebiliyorum.
Yalnız videoları oynatamıyorum neden olabilir ?
HATA : An error accurred, plese try again later.
gösteriyor.
Proxy ile Youtube izletmek?
5
●512
- 14-10-2010, 11:32:28kodu nerden aldınız ? Dikkat ederseniz o proxy jpeg header gönderiyor. header('Content-Type: image/jpeg'); Sizin içeriğiniz neyse o yönde header göndericeksiniz. Buda video olduğu için header('Content-type: video/x-flv'); olacak.
- 16-10-2010, 17:17:33
<?php function get_data($url) { $ch = curl_init(); $timeout = 10; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3'); curl_setopt($ch,CURLOPT_HEADER,1); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_REFERER,"http://www.google.com/"); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ini_set("max_execution_time",""); $url = $_GET['v']; $v = $url; $file=get_data("http://www.youtube.com/watch?v=".$v); $adres1 = explode('fmt_url_map=',$file); $adres1 = explode('&',$adres1[1]); $adres1 = urldecode($adres1[0]); $flvadres = end(explode("|", $adres1)); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $flvadres); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CULROPT_REFERER, "http://www.google.com/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_WRITEFUNCTION,"progress_function"); $data = curl_exec($ch); $i = 0; function progress_function($ch,$str) { global $i,$_GET; if($i == 0) { $info = curl_getinfo($ch); header('Content-type: video/x-flv'); header("Content-Disposition: attachment; filename=\"divxklip-" . $_GET['v'] . ".flv\""); header("Content-Length: " . $info['download_content_length']); $i = 1; } echo $str; return strlen($str); } curl_close($ch); ?>
burdadır sorun girer ama izletmez