s.a arkadsalar elimde bir script var video_ekle.php den yazdığım kelime ile ilgili videoları eklior script :s fakat çalışmıyor sorun nerde olabilir

<?
session_start();
if (extension_loaded('zlib')) {
	@ob_start('ob_gzhandler');
}
				
require('ayar.php');
require('ex.php');
require('HTTP.php');

$admin_yetki = $_SESSION['yetki'];

if (!$_SESSION['admin_id']) {
echo '<script>';
echo 'location="index.php"';
echo '</script>';
exit();
}

function get_link($id, $redirect = false) {
    $url = 'http://www.youtube.com/watch?v='.$id;
    if ($html = file_get_contents($url)) {
        if (preg_match('/\/player2\.swf\?video_id=.*?&t=(.*?)"/', $html, $match)) {
            $url = 'http://youtube.com/get_video.php?video_id='.$id.'&t='.$match[1];
            if ($redirect && $redirected_url = get_redirected_url($url)) {
                $url = $redirected_url;
            }
            return $url;
        }
    }
    return false;
}


function get_redirected_url($url) {
    $res = HTTP::head($url);
    if (preg_match('/^3/', $res['response_code'])) {
        return $res['Location'];
    }
    return false;
}





			
?>

<!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>
<meta name="content-language" content="tr"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta name="rating" content="General"/>
<meta name="distribution" content="Global / Local"/>
<meta name="resource-type" content="document"/>
<meta name="ROBOTS" content="all"/>
<meta name="SPIDERS" content="all"/>
<meta name="revisit-after" content="1 days"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="window-target" content="_top"/>
<link rel="shortcut icon" href="/favicon.ico" />
<style type="text/css" media="all">
<!--
@import url("/css/video.css");
-->
</style>

</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0"  >
<tr>
<td><center><? if (!$secili ){ $secili ="index"; } include_once "ust_menu.php"; ?>
</center></td>
</tr>
<tr>
<td ><? include_once "video_ara.php"; ?></td>
</tr>
<tr>
<td bgcolor="#BBD9EE" >
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="200" valign="top"  >
<? include_once "sol_menu.php"; ?></td>
<td valign="top" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">			
  <div align="left">
  <span class="kat">video ekle</span> 
  </div>
 
   <div align="left" class="content_bgrnd">
   <form name="video_ekle" method="post" action="video_ekle.php">
          <div align="center">Hangi kelime  
            <input type="text" name="kelime">
			<input type="hidden" name="x_ara" value="3465">
            <input type="submit" name="Submit" value="Varsa Getir">
          </div>
   </form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="content_bgrnd">
<?
if (!$_GET['ypage']) {
$page=1;
$ilk = 1;
$son = 20;
}else{
$page = $_GET['ypage'];
 
$son = $page * 20;
$ilk = $son - 19;

}


if ($_GET['kelime']) { 
$kelime = $_GET['kelime'];

}
if ($_POST['x_ara']) { 
$kelime = $_POST['kelime'];

}


if (isset($kelime)){

$kelime = rawurlencode($kelime);

$resim_temp ="v_images2/";

if (!$_GET['ypage']) {
$page=1;
$ilk = 1;
$son = 20;
}else{
$page = $_GET['ypage'];
$son = $page * 20;
$ilk = $son - 19;

}

$resim_temp ="v_images2/";

$link_url = "http://www.youtube.com/results?search_type=search_videos&search_query=".$kelime."&search_sort=relevance&search_category=0&page=".$page;

	$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$link_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $definition = curl_exec($ch);
    curl_close($ch);
				$link = $definition;

$link_2 = explode('Results '.$ilk.'&ndash;'.$son.' of ', $link);
$link_2 = explode('</div>', $link_2[1]);
$toplam = $link_2[0];
$toplam = explode('		(', $toplam);
$toplam = $toplam[0];
$toplam = str_replace("about", "",$toplam );
$toplam = str_replace(",", "",$toplam );

$sayfa = ceil($toplam / 20);

if ($toplam < 0 ) {
$toplam == 0;
}

if ($sayfa == 0){
echo "bitti";
echo "<br>";
}else { 
echo "toplam $sayfa sayfa olmak &uuml;zere $toplam video bulundu .";
echo "<br>";
}

$link_3 = explode('<!-- start search results -->', $link);
$link_3 = explode('<!-- end search results -->', $link_3[1]);
$ara_alan = $link_3[0];
$link_4 = explode('<div class="vEntry">', $ara_alan);
$link_sayi = count($link_4);
$link_sayi = $link_sayi - 1;


for ($c=1;$c <= $link_sayi ; $c++){

$link_5 = explode('<table class="vTable">', $link_4[$c]);
$link_5 = explode('</table>', $link_5[1]);
$x_alan = $link_5[0];

$link_6 = explode('<a href="/watch?v=', $x_alan);
$link_6 = explode('" rel="nofollow"', $link_6[1]);
$film_id = $link_6[0];

$sql = "SELECT film_id,film_resim FROM video_2 where film_id='$film_id' ";
	if ( !($resultlogin = $db->sql_query($sql)) )
	{
	uyari("hata var tekrar dene ..");
	}
	
	$in_sayi = $db->sql_numrows($resultlogin);
	$row = $db->sql_fetchrow($resultlogin);
	$film_resim2= $row['film_resim'];
	$film_id2= $row['film_id'];
	$db->sql_freeresult($resultlogin);

if ($in_sayi <= 0){

	

$url = get_link($film_id,'redirect=1');

$link_7 = explode(');">', $x_alan);
$link_7 = explode('</a><br/>', $link_7[2]);
$film_isim = $link_7[0];

$link_8 = explode('<span class="runtime">', $x_alan);
$link_8 = explode('</span>', $link_8[1]);
$film_sure = $link_8[0];

$link_9 = explode('<span id="BeginvidDesc'.$film_id.'">', $link_4[$c]);
$link_9 = explode('</span>', $link_9[1]);

$link_10 = explode('<span id="RemainvidDesc'.$film_id.'" style="display: none">', $link_4[$c]);
$link_10 = explode('</span>', $link_10[1]);

if (strlen($link_10[0]) > 0 ) {
$film_aciklama = $link_10[0];
}else {
$film_aciklama = $link_9[0];
}

$link_11 = explode('div class="vfacets">', $link_4[$c]);
$y_alan = $link_11[1];

$link_12 = explode('&c=', $y_alan);
$link_12 = explode('"', $link_12[1]);
$kat_id = $link_12[0];

$link_13 = explode('<div class="vtagValue">', $link_4[$c]);
$link_13 = explode('</div>', $link_13[1]);
$film_tags2 = $link_13[0];

$link_14 = explode('</a>', $film_tags2);
$tag_sayi = count($link_14);
$tag_sayi  = $tag_sayi - 1;
$film_tags ="";
for ($t=0;$t < $tag_sayi; $t++) {
$f_link_6 = explode('class="dg">',$link_14[$t]);
$film_tags .= $f_link_6[1].",";
}

$link_5 = explode('<img src="', $link_4[$c]);
$link_5 = explode('" border="0" class="vimg120"', $link_5[1]);
$resim_alan = $link_5[0];

$yeniad = $film_id.".jpg";
$en    = "130";
$boy   = "97";
$son_en = $en;
$son_boy = $boy;
$eski = @imagecreatefromjpeg($resim_alan);
if (!$eski){
$eski = @imagecreatefromjpeg($site_adres."/no_images.jpg");
}
$yeni = imagecreatetruecolor($son_en,$son_boy);
imagecopyresampled(
        $yeni,$eski,0,0,0,0,
        $son_en,$son_boy,$en,$boy);
imagejpeg($yeni,$resim_temp.$yeniad,-1);


$tarih=date("Y,m,d,H,i,s", time());
$film_id = addslashes($film_id);
$film_isim = addslashes($film_isim);
$film_aciklama = addslashes($film_aciklama);
$resim = addslashes($yeniad);
$film_sure = addslashes($film_sure);
$film_embed_kodu = addslashes($url);
$taglar = addslashes($film_tags);
$onay = 1;

switch($kat_id){
case "1":
$kat_adi = "Film & Animation";
$k_id = 1;
break;
case "2":
$kat_adi = "Autos & Vehicles";
$k_id = 2;
break;
case "23":
$kat_adi = "Comady";
$k_id = 3;
break;
case "24":
$kat_adi = "Entertainment";
$k_id = 4;

break;
case "10":
$kat_adi = "Music";
$k_id = 5;

break;
case "25":
$kat_adi = "News & Politics";
$k_id = 6;

break;
case "22":
$kat_adi = "People & Blogs";
$k_id = 7;

break;
case "15":
$kat_adi = "Pets & Animals";
$k_id = 8;

break;
case "26":
$kat_adi = "Howto & DIY";
$k_id = 9;

break;
case "17":
$kat_adi = "Sport";
$k_id = 10;

break;
case "19":
$kat_adi = "Travel & Places";
$k_id = 11;

break;
case "20":
$kat_adi = "Gadgets & Games";
$k_id = 12;

break;
default:
}




echo "film id : ".$film_id;
echo "<br>";
echo "film isim : ".$film_isim;
echo "<br>";
echo "film aciklama : ".$film_aciklama;
echo "<br>";
echo "film resim : ".$yeniad;
echo "<br>";
echo "film tags : ".$taglar;
echo "<br>";
echo '<img src="v_images2/'.$yeniad.'" />';
echo "<br>";
echo "-------------------";
echo "<br>";



$sql ="INSERT INTO video_2 (video_id,film_id,kat_id,film_isim,film_link,goruntu,tarih,kat_adi,film_resim,film_aciklama,r,taglar) VALUES ('$video_id','$film_id','$k_id','$film_isim','$film_embed_kodu','$film_sure','$tarih','$kat_adi','$resim','$film_aciklama','$onay','$taglar')";
if ( !($resultOnline_7 = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
		}

}

}

}


if ($admin_yetki != 0) {
if ($page <= $sayfa ) {
$ypage = $page + 1;
echo '<script>';
echo 'location="video_ekle.php?kelime='.$kelime.'&ypage='.$ypage.'"';
echo '</script>';
}
}

?>
</td>
</tr>

</table>

   </div>

</td>
</tr>
</table>
</td>
<td width="120" valign="top">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td  class="alt" >&nbsp;</td>
</tr>
</table>


</body>
</html>
<?
$db->sql_close();
ob_end_flush();
exit();

?>
hata kodu yok :S ama videolarıda çekemiorum