PDA


Tüm Versiyonu Göster : Rss Feed v2


PataSana
12-24-2007, 18:13
Avantajları
1) Serverınızı asla kasmaz yormaz.
2) Tamamen işinizi bota degil botu sizin yönetmenizi sağlar.
3) Kullanımı çok basittir.

+
Yenilikler bitmiyor
Haber botu eklediginde 3 cümle alır haberden ve altına haber linkini adres olarak eklemez
Devamını Oku Şeklinde otomatik tanımlama yapar.
İşte bir konudan resim:
http://img112.imageshack.us/img112/6369/adszej3.jpg
Kurulumuna geçelim.
1) SimplePie: Downloads (http://simplepie.org/downloads/) adresinden simplepie indirip serverınızın anadizinine veya forum'un kurulu olduğu klasörün içine atınız.
2) SimplePie: Server Compatibility Test 1.0 (http://www.forumlus.com/forum/simplepie/compatibility_test/sp_compatibility_test.php) gördüğünüz gibi Herşey enabled olucak disabled olmayacak.
( Sebep Hostunuzu kasan şeylerin önlemini alan kısımlardır )
3) Aşağıdaki kodları Kendinize göre düzenliyip rss.php olarak root a yada forumun kurulu olduğu klasörün içine atınız.

<?php
error_reporting(E_ALL);

require("simplepie/simplepie.inc");
// these need the full path to your SMF files
require_once('/home/siteisminiz/public_html/SSI.php');
require_once('/home/siteisminiz/public_html/Sources/Subs-Post.php');

/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","*****"); //DB Kullanıcı adı
define("DB_PASSWD","******"); // DB Şifre
define("DB_DATABASE","*******"); //DB İsmi

// initialize variables ** Don't touch these.
$sSql = "";
$aryMsgOptions = Array();
$aryTopicOptions = Array();
$aryPosterOptions = Array();
$encoding = "iso-8859-9";

// set variables ** Modify these to match your board
$iUserId = 99999; // Haber botunuzun Üye ID si
$iBoardId = 99999; // Haberin eklenecegi kategori ID si
$sRealName = "Haberci"; // Haber botunuzun üye adı
$sEmailAddr = "haberci@xxxx.net"; // Haber botunuzun mail adresi
$iMarkAsRead = TRUE; // Set this either true or false This defines whether the injected posts are marked as read.
$iUpdatePostCount = TRUE;// Set this to either true or false. This defines whether to include the injected items in your post counts.
$sFeedUrl = "http://www.zaman.com.tr/webapp-tr/kultursanat.rss"; // Bu Kısımlar rss yada xml haber cekilicek adres satırları
$iMaxItemsToRetrieve = 50; // Kaç Haber eklenicekse Haber sayısını belirtin..
// Instantiate SimplePie object
$feed = new SimplePie($sFeedUrl);





$feed->init();

$feed->handle_content_type();

$obj_db = mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());


if ($feed->data)
{
$max = $feed->get_item_quantity($iMaxItemsToRetrieve);
for ($x = 0; $x < $max; $x++)
{

$item = $feed->get_item($x);
$hoppa = $item->get_title();
$hoppa1 = iconv("UTF-8", "ISO-8859-9", $hoppa);
$tekrakibimmicrosoft = addslashes($hoppa1);

// This is a simple check to make sure that the item doesn't already exist in your SMF.
$sSql = "SELECT
COUNT(ID_MSG) AS ENTRY_EXISTS
FROM smf_messages
WHERE subject = '$tekrakibimmicrosoft'";

$obj_query = mysql_query($sSql, $obj_db) or die(mysql_error());

$int_count = mysql_fetch_assoc($obj_query) or die(mysql_error());

mysql_free_result($obj_query);

// If it's a new item, insert it!
if ($int_count['ENTRY_EXISTS'] == 0)
{
$sItemTitle = $tekrakibimmicrosoft;
//$sItemTitle = smart_trim(addslashes($item->get_title()), 50, false, "...");

$hoppa2 = $item->get_description();
$hoppa3 = iconv("UTF-8", "ISO-8859-9", $hoppa2);
$phpninustasigozlerininhastasiyim = addslashes($hoppa3);
$sItemBody = "<p>" . $item->get_date('j M Y') . "</p><p>$phpninustasigozlerininhastasiyim</p><p><a href=\"" . $item->get_permalink() . "\">Devamini Oku</a></p>";

// Setup the variables for creatPost()
$aryTopicOptions = array
(
'id' => 0,
'board' => $iBoardId,
'mark_as_read' => $iMarkAsRead,
);

$aryPosterOptions = array
(
'id' => $iUserId,
'name' => $sRealName,
'email' => $sEmailAddr,
'ip' => '127.0.0.1',
'update_post_count' => $iUpdatePostCount,
);

$aryMsgOptions = array
(
'id' => 0,
'subject' => $sItemTitle,
'body' => $sItemBody,
);

echo("************************************************** *****************<br />\r\n");
echo("title: " . $sItemTitle . "<br />\r\n");
echo("************************************************** *****************<br />\r\n");

createPost($aryMsgOptions, $aryTopicOptions, $aryPosterOptions);
}
else
{
echo("There is already a match<br />\r\n");
}
}
}

if ($obj_db) {
@mysql_close($obj_db);
}
?>


Ve en sonunda siteisminiz.com (http://siteisminiz.com) dediğinizde Haberleriniz eklenecektir.
Botumuz Demo :Haberler (http://depomp3.eu/forum/index.php?board=289.0)

Konu altından gerekli yardımlar yapılacaktır.
Saygılarımla.