I have uploaded this file with an extension of .php to my web host but nothing happens, could anybody help please.
<?php
function GrabVideo($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);
if (!curl_errno($ch))
curl_close($ch);
else
$page = false;
return $page;
}
if (isset($_GET['url'])){
$url=$_GET['url'];
$url=trim($url);
if (strstr($_GET['url'],"youtube.com")){
$youtube_page =GrabVideo($_GET['url']);
preg_match('/watch_fullscreen\?fs=(.*?)&vq=(.*?)&video_id=(.*?)&l=(.*?)&sk=(.*?)&fmt_map=(.*?)&t=(.*?)&hl=(.*?)&plid=(.*?)&/', $youtube_page, $matches);
if ($matches && isset($matches[1]) && isset($matches[3])) {
Header("Location: http://www.youtube.com/get_video?video_id=$matches[3]&l=$matches[4]&t=$matches[7]");
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Youtube Grabber Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
font-family: sans-serif;
font-size: 12px;
}
form{ margin:0; padding:0;}
#url {
font-size: 1em;
color: #222222;
background-color: #F8F8F8;
width: 295px;
margin: 0px 0px 4px 0px;
padding: 3px;
border-color: #333333 #CCCCCC #CCCCCC #333333;
border-style: solid;
border-width: 1px;
}
.submit
{ background-color: #000000;
height:22px;
border:1px solid #666666;
color:#FFF; font-size:12px;
font-weight:bold;
}
p{ margin:0; padding:2px 0}
-->
</style>
</head>
<body>
<form method="get" action="" name="form">
<input type="text" id="url" name="url" /><br>
<p> example: <a href="http://www.youtube.com/watch?v=QFrqKYwmhMc" target="_blank">http://www.youtube.com/watch?v=QFrqKYwmhMc</a></p>
<input type="submit" class="submit" value="Grab Video" />
</form>
</body>
</html>