<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<pre>
<?php
//cihan ayarları
$cihanKullaniciAdi ="kullaniciadi";
$cihanID=1;
//Wp ayarları
$wpKategorisi = 1;
//resim ayarları
$yukseklik =300;
$genislik=500;
//site
$siteadresi = "http://www.siteadi.com";
require_once 'wp-config.php';
require_once(ABSPATH . 'wp-includes/functions.php');
require_once(ABSPATH . 'wp-admin/includes/image.php');
require_once"wp-config.php";
require_once"wp-load.php";
require_once"wp-includes/wp-db.php";
require_once 'func.php';
$utf8 = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo $utf8;
function vericek($url)
{
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$adres = "http://www.cihan.com.tr/rss?user=" . $cihanKullaniciAdi . "&type=" . $cihanID;
$kaynak = vericek($adres);
$xml = @simplexml_load_string($kaynak);
//print_r($xml);
foreach($xml->channel->item as $news)
{
$aranan = array('CİHAN','cihan');
$degistir = "GH";
$metin = (string)$news->description;
$ydes= str_replace($aranan, $degistir, $metin);
$tit = mysql_escape_string($news->title);
$etiketlerham = explode(" ", $news->title);
$etiket = implode(",",$etiketlerham);
$post_array = array(
'post_title' => $tit ,
'post_content' => $ydes ,
'post_status' => 'draft',
'post_type' => 'post' ,
'post_category'=> array( $wpKategorisi ),
'tags_input' =>$etiket
);
$icerik_kontrol = @$wpdb->get_results("SELECT post_title FROM $wpdb->posts where post_title ='$tit'");
if($icerik_kontrol)
{
$kayit_durumu = 1;
}else {
$pid = wp_insert_post($post_array);
$resimler = $news->children('http://search.yahoo.com/mrss/');
$say = $resimler->count()-1;
for($i=0;$i<$say;$i++){
$rr = ( $resimler[$i]->attributes());//['url'].'<br />';
$rurl = $siteadresi . '/timthumb.php?src='.$rr["url"].'&h='. $yukseklik .'&w='. $genislik .'&zc=1';
$ResimiCek= resimbotu_ResimCek((string)$rurl );
$upload_dir = wp_upload_dir();
$ResimCek = $upload_dir["url"].'/'.$ResimiCek;
$wp_filetype = wp_check_filetype(basename($ResimCek), null );
$attachment = array(
'guid' => $ResimCek,
'post_mime_type' => $wp_filetype['type'],
'post_title' => $post_array['post_title'] = resimbotu_Escape($post_array['post_title']),
'post_content' => resimbotu_Escape($_POST['altaciklama']),
'post_type' => 'attachment',
'post_parent' => $pid
);
$attach_id = wp_insert_attachment($attachment, $ResimCek, $pid);
$postid = (int)$pid;
$attid = (int)$attach_id;
$attach_data = wp_generate_attachment_metadata($attach_id, $ResimCek);
wp_update_attachment_metadata($attach_id, $attach_data);
add_post_meta($pid, '_thumbnail_id', $attach_id, true);
update_post_meta( $pid,'_thumbnail_id',$attach_id);
update_post_meta( (int)$postid,'_thumbnail_id',(int)$attid);
set_post_thumbnail( $postid, $attid );
}
}
}
?>
</pre>
</body>
</html>func.php<?php
function dil($veri)
{
return iconv("ISO-8859-9","UTF-8",$veri);
}
function fixEncoding($x)
{
if(mb_detect_encoding($x)=='UTF-8'){
return $x;
}else{
return utf8_encode($x);
}
} // fixEncoding
function haberbotu_DetayliHaberler()
{
$Veri = haberbotu_HaberListele();
$SonVeri = array();
foreach($Veri AS $Link)
{
$SonVeri[] = haberbotu_HaberDetay("http://www.trthaber.com/".$Link);
}
return $SonVeri;
exit;
}
function haberbotu_Baglan($url)
{ $ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($ch,CURLOPT_REFERER,"http://www.trthaber.com/");
curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.02011-10-16 20:21:42");
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function resimbotu_Baglan($url)
{ $ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($ch,CURLOPT_REFERER,"http://galeri.haberturk.com/");
curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.02011-10-16 20:21:42");
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function haberbotu_ResimCek($ResimYolu)
{
$ResimAdi = basename($ResimYolu);
$Ky = wp_upload_dir();
$KlasorYolu = $Ky['path'].'/';
//copy($ResimYolu,'.././'.$ResimAdi);
$chi = curl_init($ResimYolu); //dosyayı burada alıyoruz kendi serverımıza
$fpi = fopen($KlasorYolu.$ResimAdi, "w");
curl_setopt($chi, CURLOPT_FILE, $fpi);
curl_setopt($chi, CURLOPT_HEADER, 0);
curl_exec($chi);
curl_close($chi);
fclose($fpi);
return $ResimAdi;
}
function resimbotu_Escape($deger)
{
return $deger;
}
function resimbotu_ResimCek($ResimYolu)
{
$ResimAdi = uniqid().'.jpg';
$Ky = wp_upload_dir();
$KlasorYolu = $Ky['path'].'/';
//copy($ResimYolu,'.././'.$ResimAdi);
if(function_exists('curl_init'))
{
$fp = fopen($KlasorYolu.$ResimAdi,'w+');
$ch = curl_init();
curl_setopt($ch , CURLOPT_URL, $ResimYolu);
curl_setopt($ch , CURLOPT_USERAGENT, 'firefox/2.0.11');
curl_setopt($ch , CURLOPT_FILE, $fp);
curl_exec($ch);
curl_close($ch);
fclose($fp);
}
else
{
copy($ResimYolu,$KlasorYolu.$ResimAdi);
}
return $ResimAdi;
}
function resimbotu_ResimEkle()
{
include("../././wp-load.php");
include("../././wp-config.php");
include("../././wp-admin/includes/image.php");
include("../././wp-includes/pluggable.php");
$altlink=$_POST['altlink'];
$GaleriAyir="";
$AltKonuUrl = resimbotu_Baglan($altlink);
preg_match_all('|<span style="color: #676767">/(.*?)</span>|si',$AltKonuUrl,$ResimSayisi,PREG_PATTERN_ORDER);
$sayi[]=$ResimSayisi[1][0];
for ($i = 1; $i <= $ResimSayisi[1][0]; $i++) {
$Altresim = resimbotu_Baglan($altlink."/1/".$i);
preg_match_all('|<div class="mansetResimBox">(.*?)</div>|si',$Altresim,$GaleriResimleri,PREG_PATTERN_ORDER);
$GaleriResimTagTemizle = strip_tags($GaleriResimleri[1][0],"<img>");
preg_match_all('|src="(.*?).jpg|si',$GaleriResimTagTemizle,$GaleriCiktisi,PREG_PATTERN_ORDER);
$GaleriAyir .= $GaleriCiktisi[1][0].",";
}
$PostOlustur = explode(',', $GaleriAyir);
$upload_dir = wp_upload_dir();
foreach($PostOlustur AS $PostResmi)
{
if(@$PostResmi){
$OlusanPost .= '<img src="'.$upload_dir[url].'/'.resimbotu_ResimCek($PostResmi.".jpg").'" /><!--nextpage-->';
}
}
if (strpos($_POST['kat_id'],',') === false) {
$PostKat = array($_POST['kat_id']);
}else{
$PostKat = explode(',',$_POST['kat_id']);
}
$ResimiCek= resimbotu_ResimCek($_POST['resim']);
$ResimCek = $upload_dir[url].'/'.$ResimiCek;
$my_post = array();
$my_post['post_title'] = resimbotu_Escape($_POST['baslik']);
$my_post['post_content'] = substr($OlusanPost,0,-15);
$my_post['post_status'] = 'publish';
$my_post['post_author'] = '1';
$my_post['post_category'] = $PostKat;
$my_post['tags_input'] = resimbotu_Escape($_POST['etiket']);
$post_id = wp_insert_post($my_post)or die(mysql_error());
$wp_filetype = wp_check_filetype(basename($ResimCek), null );
$attachment = array(
'guid' => $ResimCek,
'post_mime_type' => $wp_filetype['type'],
'post_title' => $my_post['post_title'] = resimbotu_Escape($_POST['baslik']),
'post_content' => resimbotu_Escape($_POST['altaciklama']),
'post_type' => 'attachment',
'post_parent' => $post_id
);
$attach_id = wp_insert_attachment($attachment, $ResimCek, $post_id);
$attach_data = wp_generate_attachment_metadata($attach_id, $ResimCek);
wp_update_attachment_metadata($attach_id, $attach_data);
add_post_meta($post_id, 'resim', $ResimCek, true);
add_post_meta($post_id, 'bilgi', resimbotu_Escape($_POST['altbaslik']), true);
return '<input type="button" style="width:100%;background-color:#58ACFA;color:white;font-weight:bold" value="'.$_POST['baslik'].' başlıklı galeri başarı ile eklendi." disabled="disabled"/>';
}
function haberbotu_HaberEkle()
{
include("../././wp-load.php");
include("../././wp-config.php");
include_once("../././wp-admin/includes/image.php");
include_once("../././wp-includes/pluggable.php");
if (strpos($_POST['kat_id'],',') === false) {
$PostKat = array($_POST['kat_id']);
}else{
$PostKat = explode(',',$_POST['kat_id']);
}
$ResimCek = haberbotu_ResimCek($_POST['resim']);
$my_post = array();
$my_post['post_title'] = $_POST['baslik'];
$my_post['post_content'] = $_POST['aciklama'];
$my_post['post_status'] = 'publish';
$my_post['post_author'] = '1';
$my_post['post_category'] = $PostKat;
$my_post['tags_input'] = $_POST['etiket'];
$post_id = wp_insert_post($my_post)or die(mysql_error());
$wp_filetype = wp_check_filetype(basename($ResimCek), null );
$attachment = array(
'guid' => $ResimCek,
'post_mime_type' => $wp_filetype['type'],
'post_title' => $my_post['post_title'] = $_POST['baslik'],
'post_content' => $_POST['altaciklama'],
'post_type' => 'attachment',
'post_parent' => $post_id
);
$attach_id = wp_insert_attachment($attachment, $ResimCek, $post_id);
$attach_data = wp_generate_attachment_metadata($attach_id, $ResimCek);
wp_update_attachment_metadata($attach_id, $attach_data);
$ResimYoluBul = wp_get_attachment_image_src($attach_id);
add_post_meta($post_id, 'resim', $ResimYoluBul[0], true);
if($_POST["bot"]=="ensonvideo")
{
add_post_meta($post_id, 'video', $_POST['altbaslik'], true);
}
else
{
if($_POST["bot"]=="youtube")
{
add_post_meta($post_id, 'video', $_POST['altbaslik'], true);
}
else
{
add_post_meta($post_id, 'bilgi', $_POST['altbaslik'], true);
}
}
return '<input type="button" style="width:100%;background-color:#58ACFA;color:white;font-weight:bold" value="'.$_POST['baslik'].' başlıklı içerik başarı ile eklendi." disabled="disabled"/>';
}
?>gerekli kütüphane : timthumb func.php
bot.php
timthumb.php
üç dosyayı wordpress ana dizine atın.
gerekli ayarlamalar bot.php içerisinde.
uğraştım bayağı bi ama , işime yaramadı, resim işlemleri yüzünden hep CPU suspend yedik

sonra sunucuya geçtik mecburen

Not : func.php dosyasını bir başka arkadaşın bot paylaşımından almıştım. bana ait değildir.