bu şekilde yerleştirdim
<?php
##
# * @author dnmtnk 4378268530
# * @copyright 2008-10-20
##
# Buffer
# -------------
ob_start();
# Database Ayarları
# --------------------
$db['host'] = '';
$db['user'] = '';
$db['pass'] = '';
$db['dbnm'] = '';
# Mysql'e Bağlan
# ----------------
mysql_connect($db['host'],$db['user'],$db['pass']) or die(mysql_error().' Mysql Bağlantı Hatası');
mysql_select_db($db['dbnm']) or die(mysql_error().' Mysql Veritabanı Seçme Hatası');
# Hedef Site Ayarları
# ----------------------
$site = 'http://www.buyuk-tire.com/resimler/yazdir.asp?haber=';
# Başlangıç ve Bitiş ID
# ------------------------
$id = (!$_GET['id'] ? '1' : $_GET['id']);
$sonid = 883;
# Bekleme Süresi
# ---------------
$bekle = 0;
# Bilgileri Oku
# ----------------
function getData($url)
{
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
# Mp3 Başlığı Al
# ------------------
function getMp3NameAndUrlAddress($content)
{
$veri = '<a>1</a>';
$ver = '<p>Y</p>';
preg_match("#<a>(.*?)<\/a>#i",$veri,$cid);
preg_match("#<title>(.*?)<\/title>#i",$content,$title);
preg_match("#<title>(.*?)<\/title>#i",$content,$cuff);
preg_match("#<h2>(.*?)<\/h2>#i",$content,$spot);
preg_match("#<table class=\"MsoNormalTable\" style=\"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">(.*?)<\/tbody></table>#si",$content,$detail);
preg_match("#<p>(.*?)<\/p>#i",$ver,$cuff_view);
preg_match("#<h4>(.*?)<\/h4>#i",$content,$image);
$content = explode("<h3>",$content);
$content = $content[1];
$content = explode("</h3>",$content);
$content = $content[0];
return array(
'title' => $title[1],
'cid' => $cid[1],
'cuff' => $cuff[1],
'spot' => $spot[1],
'detail' => $detail[1],
'image' => $image[1],
'cuff_view' => $cuff_view[1]
);
}
# Gelen Bilgileri Kaydet
# -------------------------
function saveData($title,$cid,$cuff,$spot,$detail,$image,$cuff_view)
{
$title = mysql_real_escape_string($title);
$cid = mysql_real_escape_string($cid);
$cuff = mysql_real_escape_string($cuff);
$spot = mysql_real_escape_string($spot);
$detail = mysql_real_escape_string($detail);
$image = mysql_real_escape_string($image);
$cuff_view = mysql_real_escape_string($cuff_view);
mysql_query("SET NAMES 'latin5'");
$addToSql = mysql_query("INSERT INTO news(title,cid,cuff,spot,detail,image,cuff_view) VALUES ('".$title."','".$cid."','".$cuff."','".$spot."','".$detail."','".$image."','".$cuff_view."')");
if ($addToSql !== false)
{
return true;
}
else
{
return false;
}
}
# Başlatma Fonksiyonu
# ---------------------
function Start()
{
global $site,$id,$sonid,$bekle;
$getContent = getData($site.$id);
$news = getMp3NameAndUrlAddress($getContent);
if ($id != $sonid)
{
if (trim($news['title']) == '-')
{
$id++;
header('Refresh:'.$bekle.' url='.$_SERVER['SCRIPT_NAME'].'?id='.$id);
echo '<h1>'.$id.' Numaralı Kayıt Sitede Yok. Bir Sonrakine Geçiliyor...</h1>';
}
else
{
if (saveData($news['title'],$news['cid'],$news['cuff'],$news['spot'],$news['detail'],$news['image'],$news['cuff_view']))
{
$id++;
header('Refresh:'.$bekle.' url='.$_SERVER['SCRIPT_NAME'].'?id='.$id);
echo '<h1>'.$news['title'].'-'.$news['cuff'].'-'.$news['spot'].'-'.$news['detail'].'-'.$news['image'].' Kaydedildi. Bir Sonrakine Geçiliyor...</h1>';
}
else
{
header('Refresh:'.$bekle.' url='.$_SERVER['SCRIPT_NAME'].'?id='.$id);
echo '<h1>'.$news['title'].'-'.$news['cuff'].'-'.$news['spot'].'-'.$news['detail'].'-'.$news['image'].' Kaydedilemedi. Yeniden Deneniyor...</h1>';
}
}
}
else
{
echo '<h1>Pempe Mp3 Sitesi Bilgileri Alındı.</h1>';
}
}
# Başla
# -------------
Start();
# Buffer End
# ----------------
ob_end_flush();
?>