You can own your YouTube Downloader Blog/Web just like this blog with this PHP script. PHP YouTube Downloader is script for download the video from YouTube directly on your your web/blog instead from YouTube Downloader Software. This PHP Script owned by YaniSetiawan, you can read his blog on
Sandalian.com.
This PHP YouTube Downloader script:
/*******************
Creator : Yeni Setiawan (yeni.setiawan@yahoo.com, http://sandalian.com)
*******************/
// ------ START SCRIPT ------//
ini_set('user_agent','Opera/9.24 (Windows NT 5.1; U; id)');
function get_http_header($url){
$uh = curl_init();
curl_setopt($uh, CURLOPT_URL, $url);
curl_setopt($uh, CURLOPT_HEADER, 1);
curl_setopt($uh, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($uh);
curl_close($uh);
return $res;
}
function show_url($http_header){
$arai = explode("\n",$http_header);
foreach($arai as $ini){
if(eregi("location",$ini)) $url = $ini;
}
list($sampah,$hasil) = explode("Location:",$url);
return str_replace("\n","",trim($hasil));
}
function download_youtube($url){
if(ereg('&',$url)){
if (eregi("watch\?v=(.*)&", $url, $out)) {
$video_id = $out[1];
}
}
else{
list($none,$video_id) = explode('watch?v=',$url);
}
$header = get_http_header('http://youtube.com/v/'.trim($video_id));
$secret_link = show_url($header);
list($none,$dl_url) = explode("/swf/l.swf?",$secret_link);
$video_url = 'http://youtube.com/get_video?'.$dl_url;
return $video_url;
}
// ------ END SCRIPT ------//
?>
The PHP Usage is:
// load the script
require_once('youtube.inc.php');
// download and echo the URL
echo download_youtube('http://youtube.com/watch?v=SAQZ0BDXn48');
?>