s.a arkadaşlar php ustadlarında bi yardım isteyim olucak | | s.a arkadaşlar sitem için vizyondeki filimler yakında gelecek filimler diye bot yaptım veri tabanında cekim tamm calışıyor ama bot ları calıştıramadım PHP- Kodu: <?
/*
vizyon filimler
*/
ob_start();
function baglan($url){
$oturum = curl_init();
curl_setopt($oturum, CURLOPT_URL, $url);
$h4 = $_SERVER['HTTP_USER_AGENT'];
curl_setopt($oturum, CURLOPT_USERAGENT, $h4);
curl_setopt($oturum, CURLOPT_HEADER, 0);
curl_setopt($oturum, CURLOPT_RETURNTRANSFER, true);
$source=curl_exec($oturum);
curl_close($oturum);
return $source;
}
function sil($x){
$ara = array ('’');
$degis = array ('');
$x = str_replace($ara ,$degis ,$x);
return $x;
}
function rasgele($kackarakter)
{
$char="1234567890";
for ($k=1;$k<=$kackarakter;$k++)
{
$h=substr($char,mt_rand(0,strlen($char)-1),1);
$s.=$h;
}
return $s;
}
function resim_indir($link,$name=null)
{
$link_info = pathinfo($link);
$uzanti = strtolower($link_info['extension']);
$file = ($name) ? $name : $link_info['basename'];
$curl = curl_init($link);
$fopen = fopen("../images/vizyon/".$file,'w');
curl_setopt($curl, CURLOPT_HEADER ,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0);
curl_setopt($curl, CURLOPT_FILE, $fopen);
curl_exec($curl);
curl_close($curl);
fclose($fopen);
}
//Mysql Ayarlari
$host = "localhost"; //%99 Localhosttur
$dbuser = "dd"; // Mysql Kullanici Adiniz
$dbpass = "dd"; // Mysql Kullanici Parolaniz
$dbvt = "dd"; // Veritabani Adi
$connect = @mysql_connect($host,$dbuser,$dbpass) or die ("Mysql baglanilamadi");
@mysql_select_db($dbvt,$connect) or die ("Veritabanina Baglanilamadi");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'");
echo "<title>Sinemalar.com Botu</title>";
if($_GET['sayfa']==""){
$max=20;
$data=baglan('http://www.sinemalar.com/filmler/vizyondaki/Istanbul-Avrupa');
if(eregi("</head>",$data)) {
$bol = explode("<div class=\"sol\">",$data);
if(count($bol)<$max) {
$git = count($bol);
}else{
$git = $max;}
for ($i=1;$i<=$git;$i++) {
preg_match("'<a title=\"(.*?)\" href=\"(.*?)\"'si",$bol[$i], $id);
preg_match("'src=\"(.*?)\" width=\"112\" />'si",$bol[$i], $resim);
preg_match("'a title=\"(.*?)\"'si",$bol[$i], $filmadi);
preg_match("'<h4><b>(.*?)</b></h4></li>'si",$bol[$i], $gosterimt);
$adres = $id[2] ;
$datas=baglan($adres);
$dizi = explode("<p class=\"yasla c333\">", $datas);
$dizi = explode("</div>", $dizi[1]);
$aciklama = preg_replace('/\s+/',' ',$dizi[0]);
$yonetmen = explode("netmen:</h3></td>", $datas);
$yonetmen = explode("</a>", $yonetmen[1]);
$yonetim = preg_replace('/\s+/',' ',$yonetmen[0]);
$yapim = explode("m:</h3></td>", $datas);
$yapim = explode("</h4>", $yapim[1]);
$kime = preg_replace('/\s+/',' ',$yapim[0]);
$sure = explode("<td class=\"detay_table_tr_icerik bordo\">", $datas);
$sure = explode("</td>", $sure[1]);
$kacsaat = preg_replace('/\s+/',' ',$sure[0]);
echo '
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<form name="formname" action="vizyon.php?sayfa=kaydet" target="windowName" method="post" onsubmit="window.open(\'\', this.target,\'dialog,modal,scrollbars=yes,resizable=no,width=30 0,height=200,left=362,top=284\');">
<table width="100%" border="1" bordercolorlight="#E9E9E9" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolordark="#E9E9E9" align="center">
<tr>
<th scope="row">Film Adı: </th>
<td>:</td>
<td><input name="adi" value="'.$filmadi[1].'" /></td>
</tr>
<tr>
<th scope="row">Film Yönetmeni: </th>
<td>:</td>
<td><input name="yonetmen" value="'.strip_tags($yonetim).'" /></td>
</tr>
<tr>
<th scope="row">Film Yapım: </th>
<td>:</td>
<td><input name="yapim" value="'.strip_tags($kime).'" /></td>
</tr>
<tr>
<th scope="row">Gösterim Tarihi: </th>
<td>:</td>
<td><input name="gosterim" value="'.strip_tags($gosterimt[1]).'" /></td>
</tr>
<tr>
<th scope="row">Süre</th>
<td>:</td>
<td><input name="sure" value="'.strip_tags($kacsaat).'" /></td>
</tr>
<tr>
<th scope="row">Film Resmi </th>
<td>:</td>
<td><img border="0" src="'.$resim[1].'" /></td>
</tr>
<tr>
<th scope="row">Film Açıklaması </th>
<td>:</td>
<td><textarea class="field" style="WIDTH: 416; HEIGHT: 69" name="aciklama" >'.strip_tags(addslashes(
$aciklama)).'</textarea></td>
</tr>
<tr>
<th scope="row">Film Resmi </th>
<td>:</td>
<td><input type="text" name="resim" value="'.$resim[1].'" /></td>
</tr>
<tr>
<td scope="row"> </td>
<td></td>
<td><input type="submit" name="Submit" value="Ekle"></td>
</tr>
</table>
</form>
<hr align="center">
';
}
}
}elseif($_GET['sayfa']=="kaydet"){
$adi = $_POST['adi'];
$yonetmen = $_POST['yonetmen'];
$yapim = $_POST['yapim'];
$gosterim = $_POST['gosterim'];
$sure = $_POST['sure'];
$resim = $_POST['resim'];
$aciklama = $_POST['aciklama'];
$xx = substr($resim,-4);
$say = rasgele("10")."vizyon".$xx;
$yeni = resim_indir($resim,$say);
$adres = "images/vizyon/".$say;
$ekle = mysql_query("insert into sinemalar_buhafta (adi,yonetmen,yapim,gosterim_tarih,sure,resim,aciklama) values ('$adi','$yonetmen','$yapim','$gosterim','$sure','$adres','$aciklama')");
if($ekle){
echo $adi.' Eklendi :)<br><a href="vizyon.php" title="Geri Git!">Geri</a>';
}else{
echo 'Video Eklenemedi :(<br><a href="vizyon.php" title="Geri Git!">Geri</a>';
}
}
?> PHP- Kodu: <?
/*
yakında gelecek filimler
*/
ob_start();
function rasgele($kackarakter)
{
$char="1234567890";
for ($k=1;$k<=$kackarakter;$k++)
{
$h=substr($char,mt_rand(0,strlen($char)-1),1);
$s.=$h;
}
return $s;
}
function resim_indir($link,$name=null)
{
$link_info = pathinfo($link);
$uzanti = strtolower($link_info['extension']);
$file = ($name) ? $name : $link_info['basename'];
$curl = curl_init($link);
$fopen = fopen("../images/vizyon/".$file,'w');
curl_setopt($curl, CURLOPT_HEADER ,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0);
curl_setopt($curl, CURLOPT_FILE, $fopen);
curl_exec($curl);
curl_close($curl);
fclose($fopen);
}
//Mysql Ayarlari
$host = "localhost"; //%99 Localhosttur
$dbuser = "sss"; // Mysql Kullanici Adiniz
$dbpass = "sss"; // Mysql Kullanici Parolaniz
$dbvt = "sss"; // Veritabani Adi
$connect = @mysql_connect($host,$dbuser,$dbpass) or die ("Mysql baglanilamadi");
@mysql_select_db($dbvt,$connect) or die ("Veritabanina Baglanilamadi");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'");
function baglan($url){
$oturum = curl_init();
curl_setopt($oturum, CURLOPT_URL, $url);
$h4 = $_SERVER['HTTP_USER_AGENT'];
curl_setopt($oturum, CURLOPT_USERAGENT, $h4);
curl_setopt($oturum, CURLOPT_HEADER, 0);
curl_setopt($oturum, CURLOPT_RETURNTRANSFER, true);
$source=curl_exec($oturum);
curl_close($oturum);
return $source;
}
echo "<title>Sinemalar.com Botu</title>";
header("Content-Type: text/html; charset=utf-8");
if($_GET['sayfa']==""){
$max=45;
$data=baglan('http://www.sinemalar.com/filmler/pekyakinda/');
if(eregi("</head>",$data)) {
$bol = explode("<div class=\"sol\">",$data);
if(count($bol)<$max) {
$git = count($bol);
}else{
$git = $max;}
for ($i=1;$i<=$git;$i++) {
preg_match("'<a title=\"(.*?)\" href=\"(.*?)\"'si",$bol[$i], $id);
preg_match("'src=\"(.*?)\" width=\"112\" />'si",$bol[$i], $resim);
preg_match("'a title=\"(.*?)\"'si",$bol[$i], $filmadi);
preg_match("'<h4><b>(.*?)</b></h4></li>'si",$bol[$i], $gosterimt);
$adres = $id[2] ;
$datas=baglan($adres);
$dizi = explode("<p class=\"yasla c333\">", $datas);
$dizi = explode("</div>", $dizi[1]);
$aciklama = preg_replace('/\s+/',' ',$dizi[0]);
$yonetmen = explode("netmen:</h3></td>", $datas);
$yonetmen = explode("</a>", $yonetmen[1]);
$yonetim = preg_replace('/\s+/',' ',$yonetmen[0]);
$yapim = explode("m:</h3></td>", $datas);
$yapim = explode("</h4>", $yapim[1]);
$kime = preg_replace('/\s+/',' ',$yapim[0]);
$sure = explode("<td class=\"detay_table_tr_icerik bordo\">", $datas);
$sure = explode("</td>", $sure[1]);
$kacsaat = preg_replace('/\s+/',' ',$sure[0]);
echo '
<form name="formname" action="yakinda.php?sayfa=kaydet" target="windowName" method="post" onsubmit="window.open(\'\', this.target,\'dialog,modal,scrollbars=yes,resizable=no,width=30 0,height=200,left=362,top=284\');">
<table width="100%" border="1" bordercolorlight="#E9E9E9" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolordark="#E9E9E9" align="center">
<tr>
<th scope="row">Film Adı: </th>
<td>:</td>
<td><input name="adi" value="'.$filmadi[1].'" /></td>
</tr>
<tr>
<th scope="row">Film Yönetmeni: </th>
<td>:</td>
<td><input name="yonetmen" value="'.strip_tags($yonetim).'" /></td>
</tr>
<tr>
<th scope="row">Film Yapım: </th>
<td>:</td>
<td><input name="yapim" value="'.strip_tags($kime).'" /></td>
</tr>
<tr>
<th scope="row">Gösterim Tarihi: </th>
<td>:</td>
<td><input name="gosterim" value="'.strip_tags($gosterimt[1]).'" /></td>
</tr>
<tr>
<th scope="row">Süre</th>
<td>:</td>
<td><input name="sure" value="'.strip_tags($kacsaat).'" /></td>
</tr>
<tr>
<th scope="row">Film Resmi </th>
<td>:</td>
<td><img border="0" src="'.$resim[1].'" /></td>
</tr>
<tr>
<th scope="row">Film Açıklaması </th>
<td>:</td>
<td><textarea class="field" style="WIDTH: 416; HEIGHT: 69" name="aciklama" >'.strip_tags($aciklama).'</textarea></td>
</tr>
<tr>
<th scope="row">Film Resmi </th>
<td>:</td>
<td><input type="text" name="resim" value="'.$resim[1].'" /></td>
</tr>
<tr>
<td scope="row"> </td>
<td></td>
<td><input type="submit" name="Submit" value="Ekle"></td>
</tr>
</table>
</form>
<hr align="center">
';
}
}
}elseif($_GET['sayfa']=="kaydet"){
$adi = $_POST['adi'];
$yonetmen = $_POST['yonetmen'];
$yapim = $_POST['yapim'];
$gosterim = $_POST['gosterim_tarih'];
$sure = $_POST['sure'];
$resim = $_POST['resim'];
$aciklama = $_POST['aciklama'];
$xx = substr($resim,-4);
$say = rasgele("10")."yakinda".$xx;
$yeni = resim_indir($resim,$say);
$adres = "images/vizyon/".$say;
$ekle = mysql_query("insert into sinemalar_yakinda (adi,yonetmen,yapim,gosterim_tarih,sure,resim,aciklama) values ('$adi','$yonetmen','$yapim','$gosterim','$sure','$resim','$aciklama')");
if($ekle){
echo $adi.' Eklendi :)<br><a href="yakinda.php" title="Geri Git!">Geri</a>';
}else{
echo ' Eklenemedi :(<br><a href="yakinda.php" title="Geri Git!">Geri</a>';
}
}
?> botları calıştırdıgımda sayfa boş bir sayfa gelip kalıyor nerde yanlış yaptım acaba baka bilirmisiniz
şimdiden teşekur ederim
Konu suleyman1 tarafından (30-01-2012 Saat 18:40:01 ) değiştirilmiştir..
|