Programalama > PHP

Etiketler: smf, rss, feed

Ort. 0
Puan ver:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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:
[img]http://img160.imageshack.us/img160/296/forumlusjf0.jpg[/img]
Kurulumuna geçelim.
1) 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) 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 www.siteisminiz.com/rss.php dediğinizde Haberleriniz eklenecektir.
Botumuz Demo : http://www.forumlus.com/forum/haberler-b144.0/
Forum'a 1 günde 654 konu ekledi  :)
Konu altından gerekli yardımlar yapılacaktır.
Saygılarımla.
<coder>Coded by Squealer</coder>
 
squealer
admin@forumlus.com


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2025 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.