Go
Not registered? Sign up!

NEW! .youtube.com

Google Translate
5 posts | return to the AdSolution forum | get the rss feed for this thread

Aug. 08, 2009igor

Demo: http://www.dulski.pri.ee/deadparker/index.php?id=musika
100% OK

-------------
http://www.youtube.com -> php5
<?php
if (isset($_GET['url']))
{
$url = $_GET['url'];
$v = $url;
$v = preg_split ("/\?v=/", $v);
$v = $v[1];
$watch2 ="www.youtube.com";
// $watch2 = gethostbyname("www.youtube.com");
$url = "http://" . $watch2 . "/watch?v=" . $v;
$urlss = $url;
$session = curl_init();
curl_setopt ($session, CURLOPT_URL, $url);
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
// curl_setopt($ch, CURLOPT_TIMEOUT, 25);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
if (preg_match_all("/&t=[^&]*/", $response, $matches))
{
$t = $matches[0][0];
$t = preg_split("/=/", $t);
$t = $t[1];
$youtubeVideoPath = "http://" . $watch2 . "/get_video.php?video_id=" . $v . "&t=". $t . "&fmt=18";
$headers = get_headers($youtubeVideoPath,1);


// header ("Location: $youtubeVideoPath");


if(!is_array($headers['Location'])) {
$url = $headers['Location'];
}else {
foreach($headers['Location'] as $h){
if(strpos($h,"googlevideo.com")!=false){
$url = $h;
break;
}
}
}
if ($url == $urlss ){
header("Location: $youtubeVideoPath");
}
else {header("Location: $url"); };

// print "URI: $url<br/><br/><br/>---" ;

}
else
{
echo "null";
}
curl_close($session);
}
else
{
echo 'stop';
}


?>

Aug. 19, 2009aaawd

asada

Aug. 21, 2009gökhan

seni sevilk

Aug. 21, 2009gökhan

seni seviyom

Aug. 24, 2009igor (new)

$ch2 ="http://m-yu-sokolov.livejournal.com/data/rss";
$ua = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0';
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$headers[] = 'X-FORWARDED-FOR:74.125.77.147';


$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $ch2);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_exec($ch);
$str = curl_exec($ch);
curl_close($ch);

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.