Here's my Christmas present to the SMF community. http://www.stelesys.com/content/view/21/34/ (http://www.stelesys.com/content/view/21/34/)
This script will take an RSS feed and inject it into an SMF board as posts.
It's still somewhat crude, but it works. Please let me know of any problems that you're having. You can see it in action at http://www.cyvin.org (http://www.cyvin.org) under the "News" boards.
Cheers,
Jerry
Moved this here, will get more attention than in the "Declined or Applied Requests" board
Nice. What versions of SMF does it work with?
I've tried it with 1.1rc2. I can't say if it works on earlier versions. If it doesn't, it should be a quick fix to get it to work.
Jerry
A quick questions. How did you manage to get a hold of 1.1 RC2?
-JayBachatero
Simple. I took the 1.1RC1 and added 1. Actually, I was lazy and looked at what this forum was running, since I assumed it was the latest, as mine is. Anyway, ass/u/me, you get the point :)
I take it that 1.1RC2 is a closely guarded RC?
Well there are a many changes in RC2. I'm just making sure og the version you had ;)
-JayBachatero
Is this working for rc2 because it's a nice tool to use. :) ?
Well, I dloaded the code you linked to some time ago, noted it used some file I did not have so I deleted it with out thinking. Later I figured it might be PEAR-XML, just went back to dload it again so I may tweak it to my use and cant find the link to the code again. The one on the page seems to be broken in a way, for it goes on talking about your host, not the code. Oh well guess I will have to build this idea by hand.
I'm sorry about that. I was monkeying with the site an broke the link. Here is again:
http://www.stelesys.com/content/view/21/34/index.php?option=com_content&task=view&id=21&Itemid=34
I'll give it a shot on RC2 tonight, but I would be suprised if it didn't work.
Quote from: confusion on January 03, 2006, 05:45:26 PM
I'm sorry about that. I was monkeying with the site an broke the link. Here is again:
http://www.stelesys.com/content/view/21/34/index.php?option=com_content&task=view&id=21&Itemid=34
That and the link on the site it's self is linked wrong, have to copy the url manual and paste in browser to get the code...
I'm really batting a thousand today. Actually, the problem is joomla trying to be a little too helpful. Anyhow, the link should work now. Thanks for pointing it out to me.
Jerry
Ok now that link works... but the one on the website that links to the txt file still doesn't!
Well I took it upon my self to write my own custom injector, only issue remaining is double posting, once I solve that, I will be letting it run for a day or two to be sure of no issues, then to a live site followed by thoughts of maybe letting it be released to the public.
Can I get the script? THe link provided is not workin !!
http://www.stelesys.com/projects/smfrssinjector.php.txt
Think you guys could whipe up something for birthdays and events and special occasions and new members. So that they each get a new post?
Pardon my noobie type questions, but I am not able to get this to run...I get following. I understand that I need to have that rss.php, but where to get it from?
Warning: main(XML/RSS.php): failed to open stream: No such file or directory in /home/vpahuja/public_html/smfrssinjector.php on line 12
Warning: main(XML/RSS.php): failed to open stream: No such file or directory in /home/vpahuja/public_html/smfrssinjector.php on line 12
Fatal error: main(): Failed opening required 'XML/RSS.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/vpahuja/public_html/smfrssinjector.php on line 12
Google: PEAR XML RSS (http://www.google.com/search?q=PEAR+XML+RSS)
Thanks. I believe I have made considerable progress here. I am now able to get the script run, but the script only injected two post !!!
Is there a counter or something that is preventing this script to insert more than 2 posts?
The RSS feed that I am working with is
http://forum.joomla.org/index.php/board,162.0/type,rss2/sa,news/action,.xml
I am suspecting that it might have to do with Indic Language....
Quote from: TLM on January 05, 2006, 01:03:52 AM
Google: PEAR XML RSS (http://www.google.com/search?q=PEAR+XML+RSS)
hi
since im a newb..any chance of explenation?
What do you want explained?
Table 'pakecono_pp.smf_messages' doesn't exist
this is the error im getting at the moment.
realised it had wrong table titles....so updated them and it works.
:D
mua ha ah ah aha
yeeeh haww...
here is a more user friendly version...and way of presenting to noobs like me.
http://www.pakeconomist.com//Varius%20Pics/injector.rar
unzip it. (needs winrar) and then open the file news.php in wordpad and edit all the fields which need to be edited.
(upto the source of the feed)
save the file as news.php
and upload it.
then you can open the http://www.yourdomain.etc\injector\news.php
and a blank screen will come....thats it.
go to your forum and check the location you selected. if there are no names then that means you have entered the username and not the userid (which is usualy the number)
any problems...report here.
the above i am not sure will work for 1.1rc2.
it will work for 1.6 though.
it seems like the tables 1.6 creates in SQL have difrent names to the ones 1.1rc2 creates?
ill upload the version compatible with 1.1rc2 in a few hours...so hold you horses.
(word of advice to SMF coderz...standerdise!)
Edit
-----------------------------------------------
Fears are over...
But be aware. it will not work for one of the SMF versions (doent ask which)
if you have errors..post them here.
I am still not able to get this to work with UTF-8 encoding and Indic Characters...
ok what seems to be the problem? what errors are you getting?
no errors, it is just not working...
I downloaded the injector.rar file. I there a step by step how to set this up. I get I have to configure the php files and place them on my server but how do I pull it into a forum topic. If someone can right a from scratch step by step in laymans terms it would be much appreciated.
I think I was able to get it to work just fine. What I mean is that the script is not working for UNICODE characters....
In my case the RSS I have that I want to inject has Hindi/Sanskrit/Malyalam charachters. This injector does not insert them....It does insert the other until it found the UNICODE charachter I believe.
This is what I was able to accomplish
http://www.joomlaindia.org/test/smf/
The RSS is from this board...
http://forum.joomla.org/index.php?board=162.0
aah.
the script i doent think is able to handle those characters.
Quote from: Grandnegis on February 22, 2006, 06:26:30 AM
I downloaded the injector.rar file. I there a step by step how to set this up. I get I have to configure the php files and place them on my server but how do I pull it into a forum topic. If someone can right a from scratch step by step in laymans terms it would be much appreciated.
the injector reads the feed and inserts the articles seperatly in the apropriate table in the SQL. so they just APPEAR in your forum. you doent have to set up anything on your forum how ever to get the script to work automaticly you might have to set up a cron job which executes the script automaticly after every 20 minutes as i have set it. you doent have to set up any thing else..just the things the writer of the script asks. but the writer did not include certain files which are required for the script to function properly so i thought it would be helpfull to include those in aswell and sort the script out so it works out of the box.
(the script will have to executed...ie visit the url the script is @ and it will come up with a blank page...but would have done its job.)
ok I am getting this error;
Warning: main(PEAR.php): failed to open stream: No such file or directory in /client/home/iamwhistler/docs/forums/injector/Parser.php on line 39
Fatal error: main(): Failed opening required 'PEAR.php' (include_path='.:/php_includes') in /client/home/iamwhistler/docs/forums/injector/Parser.php on line 39
What is PEAR.php????
i think it should work if you rename the RSS.php to PEAR.php
if that does not work then open the Parser.php in a editing program (dreamweaver or anything else with search function)
and search for "PEAR.php" and replace it with "RSS.php"
this would tell the parser to look for RSS.php and not PEAR.php which does not exist.
Now I get this error;
Fatal error: Class xml_rss: Cannot inherit from undefined class xml_parser in /client/home/iamwhistler/docs/forums/injector/PEAR.php on line 36
AND if I change it to RSS I get an error on line 96 in the php file. I will jsut wait I am working on a different way of doing this anyway using a portal program combined with SMF.
@ Sharjeel66
It doesn't seem to work for me...
---------------
Runnin 1.1RC2.
I downloaded the injector.
I edited the news.php file. Filled in my HOSTNAME, USERNAME, PASSWD, and DATABASE.
USERID = 4
BOARDID = 35
(also tried 1 and 1)
I inserted the feed url: http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml
Uploaded to root directory of SMF.
I run the news.php file: http://xboxnarc.com/injector/news.php (blank page)
Nothing as appeared in my forum. What am I doing wrong? Did I miss something?
ok...got a new one:
My host uses a format for the databases of USERNAME_DB, where username is my username for the host and DB is the name of the Database (in this case SMF)
So I filled out the news feed so:
define("DB_HOSTNAME","webhost.com"); //Insert your DB server name here
define("DB_USERNAME","USERNAME_smf"); //DB username here
define("DB_PASSWD","********"); // DB password here
define("DB_DATABASE","smf"); //DB name here
$userid = 17; //Set this to the SMF userid you want the messages posted from
$boardid = 35;//Set this to the id of the board you want to post the messages in
this returns an error that it cannot connect to the database, so I changed the Database to USERNAME_smf, and then it says it cannot find the USERNAME_smf_messages table.
The problem is the literal nature of the above info...of course the database doesn't exist...but if I try to trick it by just putting the SMF part, then access is denied because it tries to connect to a database that doesn't exist...any ideas how to fix it?
Update...I see what the problem is but I cannot figure out how to fix it...when it goes to select the database, instead of selecting technodrag_smf_messages, it is trying to select technodrag_smf._messages.
Why is it inserting that period and how do I make it stop?
Update...got it figured out...now...how do I make it show all of these posts as new...currently they show as read posts and how is it going to attract attention from memebers if they all show as read?
I've been fiddling with it, and still no luck. IK entered all the info right, uploaded the injector/files to my root directory. I get a blank page (no errors) when I run the news.php file. However nothing shows up in my forum.
/** DATABASE Configuration */
define("DB_HOSTNAME","*myhostname"); //Insert your DB server name here
define("DB_USERNAME","*myusername"); //DB username here
define("DB_PASSWD","******"); // DB password here
define("DB_DATABASE","*mydbname"); //DB name here
$userid = 4; //Set this to the SMF userid you want the messages posted from
$boardid = 35; //Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS('feed.xml'); //Used this for testing with local file, a bit quicker
Is that all I edit?
This script is a really great idea, and I'd like to get it working, but im getting this error:
QuoteTable 'schultz_forum.messages' doesn't exist
Could someone tell me what I need to edit in order to make this work?
Im using the news.php file btw.
@balzizras
you have to manually edit the news.php file.
at each sql call for the table you have to add the prefix for the table.
so example... messages should be smf_messages (or whatever prefix you have in your database)
i am looking at a way to recode the template so there is less editing by using ssi calls, but it is slow going for me as I am new to all of this
i wish i knew what you guys are talking about.
as a new person to all this stuff. it is just too overwhelming.
I'm putting together a forum for our group, at least trying to...all i want is to include news feeds within a couople of topics, but all this editing and stuff of these files i dont even know what you're taling about.
I don;t even know where the files are on my website...or anything...
just a newbie...
can't someone write up a simple step by step from square 1 for new guys?
SMF seems not user friendly anyway compared to the php board I originally tried to run
If you run SMF with say Tiny Portal and no mods it is a very user friendly system...the majority of the talk here is for modifying the forum do do more than it was coded to do.
If you are looking for just an rss feed, you can use a package called Tiny Portal (www.tinyportal.net) and it uses an easy system of "blocks" one of which is designed to do rss feeds.
If you are looking to have the feeds entered into your forum as topics and posts that is what this is for and I can help you with the setup if you like.
Also,most of the files that ever need to be modified are usually in one of two places...either the sources directory or the default theme directory.
Well I got rid of the error i mentioned above, but now I'm getting this one:
QuoteDuplicate entry '0-48' for key 2
Any idea what is wrong?
post a copy of your news.php here and I'll take a look at it
You can't have attachments here...
Quote<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","schultz_smf1"); //DB username here
define("DB_PASSWD","notpostingmypassherelol"); // DB password here
define("DB_DATABASE","schultz_forum"); //DB name here
$userid = 8; //Set this to the SMF userid you want the messages posted from
$boardid = 48.0;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://newsrss.bbc.co.uk/rss/newsplayer_world_edition/sci-tech/rss.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
There ya go thanks.
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME",""); //Insert your DB server name here
define("DB_USERNAME",""); //DB username here
define("DB_PASSWD",""); // DB password here
define("DB_DATABASE",""); //DB name here
$userid = 8; //Set this to the SMF userid you want the messages posted from
$boardid = 48;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://newsrss.bbc.co.uk/rss/newsplayer_world_edition/sci-tech/rss.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
There...you missed some of the database calls.
Quote from: technodragon73 on March 19, 2006, 03:32:27 PM
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME",""); //Insert your DB server name here
define("DB_USERNAME",""); //DB username here
define("DB_PASSWD",""); // DB password here
define("DB_DATABASE",""); //DB name here
$userid = 8; //Set this to the SMF userid you want the messages posted from
$boardid = 48;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://newsrss.bbc.co.uk/rss/newsplayer_world_edition/sci-tech/rss.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
There...you missed some of the database calls.
I'm completely lost.
There were minor ommissions in there. I found them as I had exactly the same problem with it when I tried to use it.
@technodragon73
What version of SMF do you have it installed on?
I'm getting this error now :
QuoteAccess denied for user: 'schultz@localhost' (Using password: NO)
I only saw two places to put my password, am I blind or stupid? (prolly) what am I doing wrong now?
Btw; sorry to bother you..
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("localhost",""); //Insert your DB server name here
define("schultz_smf1",""); //DB username here
define("mypass",""); // DB password here
define("schultz_forum",""); //DB name here
$userid = 8; //Set this to the SMF userid you want the messages posted from
$boardid = 48;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.news.yahoo.com/rss/topstories'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(localhost,schultz_smf1,mypass) or die (mysql_error());
/** select the intended database */
@mysql_select_db(schultz_forum,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
There's only one place to put yer password.
I don't think you should have done it the way you have. cut & paste techno's last reply with the news.php code and fill in the info. It should work for your particluar DB...
Cut and paste this code and write in your DB password in the configuration.
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","schultz_smf1"); //DB username here
define("DB_PASSWD","yourDBpassword"); // DB password here
define("DB_DATABASE","schultz_forum"); //DB name here
$userid = 8; //Set this to the SMF userid you want the messages posted from
$boardid = 48;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.news.yahoo.com/rss/topstories'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
Sorry...i figured he would know to put his info in the right spaces...lol
Quote from: Xarcell on March 19, 2006, 05:03:58 PM
Cut and paste this code and write in your DB password in the configuration.
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","schultz_smf1"); //DB username here
define("DB_PASSWD","yourDBpassword"); // DB password here
define("DB_DATABASE","schultz_forum"); //DB name here
$userid = 8; //Set this to the SMF userid you want the messages posted from
$boardid = 48;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.news.yahoo.com/rss/topstories'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
Ok I used the above code, and I finially see what I was doing wrong.. But anyway Im still getting the error I had before: Duplicate entry '0-48' for key 2
first, does that board number actually exist?
Second, if it doesn't you need to create a board with that ID.
If it does, try using another board to make sure that is/is not the problem.
When I had the error I had to first add the database prefix, then I had to change the board
Quote from: technodragon73 on March 19, 2006, 08:12:01 PM
first, does that board number actually exist?
Second, if it doesn't you need to create a board with that ID.
If it does, try using another board to make sure that is/is not the problem.
When I had the error I had to first add the database prefix, then I had to change the board
First yep that board/board number did exist. Anyway I changed it to another board and it worked.. weird.
So thanks a bunch for helping me out. I know it took me long enough,.. heh. :)
Anyway one more question, would it be as simple as adding more of this line:
$rss_feed = & new XML_RSS('');
to get it to post from multi rss feeds? Or am I just being stupid.. Thanks again.
EDIT: Nevermind i tried it (duh why didn't I think of that) and it does work.
EDIT: It won't insert feeds from this site: http://info.detnews.com/rss/index.cfm
Any idea why?
Probably becasue oif the way the rss feed is provided...even though you can add mulitple rss feedss to the news file, you might try creating different files with different names (news.php does not need to be named that and no editing is required if you change the file name), that way you can independently run the feeds if you like rather than run them all at once.
Plus after you run the file(s) make sure to go to the admin section and run recount forum totals and find and fix errors...
lastly...if anyone can figure out how to make the posts from this show up as new in the recent posts (TP uses a block for this) I would be greatly appreciative.
Yes...I want to put the feeds into a topic. I appreciate the offer on helping me do this.
Where do we start?
Did I say thank you ?
thanks :)
Quote from: technodragon73 on March 19, 2006, 01:22:22 PM
If you run SMF with say Tiny Portal and no mods it is a very user friendly system...the majority of the talk here is for modifying the forum do do more than it was coded to do.
If you are looking for just an rss feed, you can use a package called Tiny Portal (www.tinyportal.net) and it uses an easy system of "blocks" one of which is designed to do rss feeds.
If you are looking to have the feeds entered into your forum as topics and posts that is what this is for and I can help you with the setup if you like.
Also,most of the files that ever need to be modified are usually in one of two places...either the sources directory or the default theme directory.
Quote from: daveso on March 20, 2006, 05:40:12 PM
Yes...I want to put the feeds into a topic. I appreciate the offer on helping me do this.
Where do we start?
Did I say thank you ?
thanks :)
Quote from: technodragon73 on March 19, 2006, 01:22:22 PM
If you run SMF with say Tiny Portal and no mods it is a very user friendly system...the majority of the talk here is for modifying the forum do do more than it was coded to do.
If you are looking for just an rss feed, you can use a package called Tiny Portal (www.tinyportal.net) and it uses an easy system of "blocks" one of which is designed to do rss feeds.
If you are looking to have the feeds entered into your forum as topics and posts that is what this is for and I can help you with the setup if you like.
Also,most of the files that ever need to be modified are usually in one of two places...either the sources directory or the default theme directory.
Hmmmm...well, you could contact me on msn and i can send you the files you need from there since you cannot attach anything in this topic.
Hmm I need help please.
I have filled everything out, checked the board number, userID, and the database prefix.
I use the file and I get a blank page, but nothing happens to my forum :(
post a link to the site so i can take a look
Doesn't work with RC2
Not true...that is the version of SMF i am using.
I first of all... Awesome work! I'm really impressed. Got the script to work and it works great!!!
I've got two questions.
1) is there a way to batch enter in RSS feeds? that way a person would only have to run the news.php file once.
2) is there a way to automate this script so that it retrieves the RSS items and converts them to posts as they come?
Quote from: technodragon73 on March 21, 2006, 08:38:29 PM
post a link to the site so i can take a look
http://www.tactical-illusion.com/board
should be going into the sport area.
Quote from: L.G.S on March 22, 2006, 11:58:48 AM
Quote from: technodragon73 on March 21, 2006, 08:38:29 PM
post a link to the site so i can take a look
http://www.tactical-illusion.com/board
should be going into the sport area.
do you have a test account?
that way i can view the booard and topics.
What am I doing wrong then? I can't seem to get it to work, and I want it to work so bad...
Quote
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","360.xboxnarc.com"); //Insert your DB server name here
define("DB_USERNAME","narcmaster"); //DB username here
define("DB_PASSWD","*********"); // DB password here
define("DB_DATABASE","gamemod"); //DB name here
$userid = 4; //Set this to the SMF userid you want the messages posted from
$boardid = 35;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS('feed.xml'); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
[/qoute]
I am so sorry Xarcell...I did not realize you were looking for help as well, you are usually the helper...lol
It looks to me like you are missing the prefix for your tables in the body of the code....
try this (you obviously need to put your password in and this is assuming that you are using the smf_ prefix):
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","360.xboxnarc.com"); //Insert your DB server name here
define("DB_USERNAME","narcmaster"); //DB username here
define("DB_PASSWD","*********"); // DB password here
define("DB_DATABASE","gamemod"); //DB name here
$userid = 4; //Set this to the SMF userid you want the messages posted from
$boardid = 35;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS('feed.xml'); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
let me know if this works for ya!
Same as before.
When I run the news.php file I don't get any errors, but nothing shows up in the forums...
what is the link to your board you are trying to post in?
www.xboxnarc.com
the "Xbox.com" board...
www.xboxnarc.com/injector/news.php
Try this...I got it to work on my forum...just make sure you have the top four items correct...
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","360.xboxnarc.com"); //Insert your DB server name here
define("DB_USERNAME","narcmaster"); //DB username here
define("DB_PASSWD","********"); // DB password here
define("DB_DATABASE","gamemod"); //DB name here
$userid = 5; //Set this to the SMF userid you want the messages posted from
$boardid = 25;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
Still no prevail...
hmmmm....Are you sure that the details at the top are correct? All i did with that posted info was put my details in there in it's place (plus change the userid and board number) and it worked flawlessly.
try using a different board and/or userid just to test it out
Quote from: technodragon73 on March 22, 2006, 05:08:40 PM
Quote from: L.G.S on March 22, 2006, 11:58:48 AM
Quote from: technodragon73 on March 21, 2006, 08:38:29 PM
post a link to the site so i can take a look
http://www.tactical-illusion.com/board
should be going into the sport area.
do you have a test account?
that way i can view the booard and topics.
username: test
pass: test
Quote from: L.G.S on March 23, 2006, 12:30:55 PM
Quote from: technodragon73 on March 22, 2006, 05:08:40 PM
Quote from: L.G.S on March 22, 2006, 11:58:48 AM
Quote from: technodragon73 on March 21, 2006, 08:38:29 PM
post a link to the site so i can take a look
http://www.tactical-illusion.com/board
should be going into the sport area.
Did you try copying and pasting the last code update from this page? Try that and put your info in there and let me know what happens.
do you have a test account?
that way i can view the booard and topics.
username: test
pass: test
I have tried the code yes, and nothing. Worked once now it's dead.
it worked once?
Well it may not be working not because it is broken, but because there are no new news coming rom that feed...the php file is designed to test against what has already been posted and skip it if it thinks it is already there...try a different feed and see what happens
You have to run the new.php to show feeds each time, unless you set up a cron job to run it for you automactically.
Quote from: Xarcell on March 24, 2006, 09:58:14 PM
You have to run the new.php to show feeds each time, unless you set up a cron job to run it for you automactically.
Did you get your to work? I hadn't heard from you in awhile. Just wondering.
Quote from: Xarcell on March 24, 2006, 09:58:14 PM
You have to run the new.php to show feeds each time, unless you set up a cron job to run it for you automactically.
Yes I know that, I did read the posts.
thanks for the help everyone, although I think I will not use this
Scratch that last comment, I have figured it out.
Although I have one problem, when I click MARK READ in recent posts they never go away :(
ok, that is a very fixable problem. Go into your admin panel, click forum maitenence, click recount forum statistics. Once that it complete, click fixes all errors and click yes...voila...problems go away!
It is a bug that I cannot figure out how to fix. (not that familiar with coding)
Nope, they are all still there lol.
Also how do I make them appear on the forum index as new posts? in the 'last post' are it always says NA
Quote from: L.G.S on March 25, 2006, 11:57:06 AM
Nope, they are all still there lol.
Also how do I make them appear on the forum index as new posts? in the 'last post' are it always says NA
That is another problem i have been trying to get fixed....I did not write the original coding for this...jsut figured out how to get it to work. Anyone that can answer that question of how to make them show up as "new" would be greatly appreciated...as far as NA...it is because the injector uses the member ID rather than the name...I could not figure out how to get it to do that either.
ok thanks,
I guess I will have to wait until someone picks up on this.
Quote from: L.G.S on March 25, 2006, 02:23:21 PM
ok thanks,
I guess I will have to wait until someone picks up on this.
You can see how it works at my site...I have three different boards right now using it:
http://forum.technodragon.net/index.php?board=56.0
http://forum.technodragon.net/index.php?board=57.0
http://forum.technodragon.net/index.php?board=58.0
(Actually I have more, but I figure these are enough to see what works)
I do not know what you are trying to show me but mine are here:
http://www.tactical-illusion.com/board/index.php?board=167.0
Damnit, wish mine would work...
Quote from: L.G.S on March 25, 2006, 07:10:07 PM
I do not know what you are trying to show me but mine are here:
http://www.tactical-illusion.com/board/index.php?board=167.0
So basically you got yours working? Except for the "new" issue?
Quote from: Xarcell on March 25, 2006, 08:50:47 PM
Damnit, wish mine would work...
Yours is still not working at all?
Yes they are working except for the part where they dont show as new.
I'm not too good with code, where would I increase the post characters?
Quote from: L.G.S on March 26, 2006, 05:32:01 AM
Yes they are working except for the part where they dont show as new.
I'm not too good with code, where would I increase the post characters?
The post is entirely dependant on what the news feed provides...it doesn't pull any more info than the fedd gives...so if it only gives a link and title...that is all you get, but if it gives more (as some do) like an image, brief summary, and link then you get that instead.
ok, thanks.
@ L.G.S
At first you where having the same problem I was. Now yours is work. What did you do to get it to work?
Can I please get a copy of the news.php you used? Just remove your password and such.
Thanks,
-Xarcell
I now have a file for each news type, so here is my world news file:
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
// This script requires XML_RSS and PHP Pear Libraries
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
/** the PEAR XML_RSS object/class is required */
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME",""); //DB username here
define("DB_PASSWD",""); // DB password here
define("DB_DATABASE",""); //DB name here
$userid = 475; //Set this to the SMF userid you want the messages posted from
$boardid = 170.0;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://news.google.co.uk/nwshp?tab=wn&ned=uk&topic=w&output=rss'); //Insert your URL here
//$rss_feed = & new XML_RSS(''); //Used this for testing with local file, a bit quicker
// Function for shortening articles based on maximum length
function str_stop($string, $max_length){
if (strlen($string) > $max_length){
$string = substr($string, 0, $max_length);
$pos = strrpos($string, " ");
if($pos === false) {return substr($string, 0, $max_length)."...";}
return substr($string, 0, $pos)."...";
}else{return $string;}
}
/** create the database connection object */
$obj_db = @mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWD) or die (mysql_error());
/** select the intended database */
@mysql_select_db(DB_DATABASE,$obj_db) or die (mysql_error());
$rss_feed->parse();
$num_articles=0; //Variable used to count number of new articles, displayed in an email below
// Here we make sure that feed articles do not already exist in DB
// this uses title names, make sure to use the same title formatting here as you will use further down
// state = 1 not trashed
foreach ($rss_feed->getItems() as $item) {
$obj_query = @mysql_query("
SELECT
COUNT(ID_MSG) AS link_match
FROM
smf2_messages
WHERE
subject = '". str_stop(addslashes($item['title']),100) ."'
",$obj_db) or die(mysql_error());
$int_count = @mysql_fetch_assoc($obj_query) or die(mysql_error());
mysql_free_result($obj_query);
if ($int_count['link_match'] == 0) {
$num_articles = $num_articles +1;
/**
* REFORMATTING CODE
**/
// In my experience you have to play with the definitions from different RSS feeds - some rss feeds call fields different things.
$titletext = str_stop(addslashes($item['title']),100);
// This adds an html link at to the original article at the very bottom of the post.
$maintext = addslashes($item['description']) . "<p><a href=\"" . $item['link'] . "\">" . $item['link'] . "</a>";
@mysql_query("
INSERT INTO smf2_topics(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
) VALUES (
'$boardid',
'$userid',
'$userid'
)
",$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
@mysql_query("
INSERT INTO smf2_messages(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
) VALUES (
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)
",$obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
@mysql_query("
UPDATE smf2_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'
",$obj_db) or die(mysql_error());
//Increment total posts for board
@mysql_query("
UPDATE smf2_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'
",$obj_db) or die(mysql_error());
//Increment Total Messages
@mysql_query("
UPDATE smf2_settings
SET value = value + 1
WHERE variable = 'totalMessages'
",$obj_db) or die(mysql_error());
//Increment Total Topics
@mysql_query("
UPDATE smf2_settings
SET value = value + 1
WHERE variable = 'totalTopics'
",$obj_db) or die(mysql_error());
// Increment post count for user record
@mysql_query("
UPDATE smf2_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'
",$obj_db) or die(mysql_error());
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
I did exactly the same thing...every feed has a different file...now if I had enough CRON jobs to run them all! LOL
Would somebody mind telling me what I would need to enter for a cronjob? I tried tutorials from google but it makes no sense to me :(
I need a file located at /board/news/file.php
to run every 1 hour
doesn't your server provide documentation? I'll see what I can find for you. I user an off-site cronjob provider that was easy and free.
nope they dont :(
Quote from: L.G.S on March 27, 2006, 10:57:31 AM
nope they dont :(
Well, if it is similar to what i have seen you pick how often it runs and the command would just be the path to your file. usually without the http:// part
ok thanks,
because I tried it with http:// and I got emails saying the directory could not be found
Quote from: L.G.S on March 27, 2006, 12:51:19 PM
ok thanks,
because I tried it with http:// and I got emails saying the directory could not be found
coolness...just let me know if it works. Oh, btw, have you rmembered to go to recount forum statistics, and find and fix errors?
yeah, everything is fine except NEW posts as I said
Quote from: L.G.S on March 27, 2006, 01:48:26 PM
yeah, everything is fine except NEW posts as I said
Ya, hopefully someone will help us out there
This is a neat script. However, it is not without its issues...
Primarily, it does not appear to insert the messages properly. If you run it, then go to forum maintenance, then find and repair any errors, it reports issues with the messages that were added. Also, probably related, the last post column on the main forum screen
does not contain anything about the new posts.
Is there any way to run forum maintenance (repairboards) from the command line/cron job? I would be OK with using this script if I could automatically run the maintenance afterwards. Ideally, however, it should be fixed to insert its messages properly.
I noticed that too, but i am not good enough in coding to fix that problem either.
Nice mod. I had to edit it to get it to work but it's running now.
In your edits did you fix it so that it doesn't need forum maintenance after it does its inserts?
Um. Now I'm getting this cron error
/public_html/injector/news.php: line 1: ?php
: No such file or directory
/public_html/injector/news.php: line 2: //
: No such file or directory
/public_html/injector/news.php: line 3: //: is a directory
/public_html/injector/news.php: line 4: //: is a directory
/public_html/injector/news.php: line 5: //: is a directory
/public_html/injector/news.php: line 6: //: is a directory
/public_html/injector/news.php: line 7: //: is a directory
/public_html/injector/news.php: line 8: //
: No such file or directory
/public_html/injector/news.php: line 133: unexpected EOF while looking for matching `''
/public_html/injector/news.php: line 142: syntax error: unexpected end of file
What am I doing wrong?
looks like you have your path setting wrong with using the cron job
Is there a way to add more than one rss feed to the news.php file?
The only way I found was to make another file and paste the code from the original in, just changing the feed link.
Thanks,
That's the only way that i figured out as well. However, I was hoping there was a better way, that way i could put in a set of newsfeeds and set the cron job for just one file. If anyone has any insight on how to do this it would be much appreciated.
potentially if you are any good at coding you could create a php file that would run all of your news feed php files. Then set a cron job to run that file. I just haven't figured out a way to do it yet.
You know this is a great script i was just wondering if it was available for any other forums as well. I know I probably shouldn't be asking here ::), but I have another forum that's running on phpBB2 and was hoping this would work for it.
There is a similar product for phpBB2 called NewsSync but I don't think it's being actively supported any longer.
Here is a thread about it: http://www.phpbb.com/phpBB/viewtopic.php?t=121946
ok, I tried this, and ended up with;
QuoteWarning: main(RSS.php): failed to open stream: No such file or directory in /home/*****/public_html/phpBB2/injector/news.php on line 34
Warning: main(RSS.php): failed to open stream: No such file or directory in /home/*****/public_html/phpBB2/injector/news.php on line 34
Warning: main(RSS.php): failed to open stream: No such file or directory in /home/*****/public_html/phpBB2/injector/news.php on line 34
Fatal error: main(): Failed opening required 'RSS.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/*****/public_html/phpBB2/injector/news.php on line 34
require 'RSS.php';
/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME","********"); //DB username here
define("DB_PASSWD","******"); // DB password here
define("DB_DATABASE","smf"); //DB name here
$userid = 15; //Set this to the SMF userid you want the messages posted from
$boardid = 87;//Set this to the id of the board you want to post the messages in
/** pull list of remote RSS feeds, via a remote RSS feed. */
$rss_feed = & new XML_RSS('http://microsoft.weblogsinc.com/rss.xml'); //Insert your URL here
ok, I figured out a bit more on my own, and now I just have;
QuoteAccess denied for user: '*******_@localhost' (Using password: YES)
Quote from: linux_learner on April 08, 2006, 08:15:06 PM
ok, I figured out a bit more on my own, and now I just have; QuoteAccess denied for user: '*******_@localhost' (Using password: YES)
This looks like you have an incorrect login. Either username or password.
The injector is working fine on my forum http://forums.u2torrents.com
now i have
QuoteTable 'goofynut_smf.messages' doesn't exist
okay, the issue i see (and it has been a problem for everyone) is in the news.php file you seed to manually change it so that all the table refrences have your db prefix in them
Quote from: technodragon73 on April 08, 2006, 10:12:55 PM
okay, the issue i see (and it has been a problem for everyone) is in the news.php file you seed to manually change it so that all the table refrences have your db prefix in them
ok, i posted my code previously. can you give me an example of what you mean? i don't quite get you.
got it. took another browse through this thread, and solved it. ( i read this thread like for times ::) :o )
now can someone tell me how to do different feeds under different catagories?
Quote from: linux_learner on April 08, 2006, 11:59:07 PM
got it. took another browse through this thread, and solved it. ( i read this thread like for times ::) :o )
I'll need to see the entire code to be able to show you...you only posted the top part of it.
Quote from: linux_learner on April 09, 2006, 12:37:01 AM
now can someone tell me how to do different feeds under different catagories?
just change the board id and create a different news.php file...they do not have to be named news.php, could even be xbox.php or anything.
Thanks. I have it all done now. Just one last question, does this program automatically import the news every so often? Or do I need to refresh each one everyso often?
you have to either manually run the php file to import the news, or use a cron job to run it for you
ok. I have never done a cron job before. Whats the command that I would use?
Quote from: linux_learner on April 09, 2006, 11:15:11 AM
ok. I have never done a cron job before. Whats the command that I would use?
Typically in simple mode you just paste the path to the file...
something like /home/www/yourdomain/news.php
you can get the server path from the server settings in smf
Either the file isnt pulling in news, or, theres no news on the server, or the command doesn't work. In any case, I dont seem to be getting any new news from any of my source, whether i manually refresh or not.
the code was written in a way to make sure it did not repost the same news...so it is possible that there is no new news to pull.
Quote from: technodragon73 on April 04, 2006, 09:31:57 PM
potentially if you are any good at coding you could create a php file that would run all of your news feed php files. Then set a cron job to run that file. I just haven't figured out a way to do it yet.
You could also make it parameter-driven so that you pass in the URL each time you run the script. Would not be hard to implement.
Thanks to the instructions in this thread, the script is working nice for me. I have one request now that I've played with it. I'm interested in injecting one RSS feed that consists of 5-8 topics. Since this is a short feed, I would like all 5-8 topics to appear in one single post on my forum as opposed to 5-8 individual posts. Any clues on how to hack the code to achieve this? I'm referring to the "news.php" code...
OK, I still have a problem with this not working for some reason.
I have done a couple of tests and think maybe it's something to do with my host.
I installed SMF on Host A, ran the script and everything worked like a charm.
I installed SMF on Host B, ran the script and got nothing. I got a blank page, but no results.
So, I know the script works on one host, FutureQuest, but it doesn't work on the second host DreamHost.
Anyone have any ideas as to why it would work on one host, but not another?
Thanks for any suggestions.
Jamie
I also use dreamhost, and this script doesn't work for me either. I'm beaten my head against the wall trying to figure it out. If you figure it out, please let me know.
Dreamhost is a great host, but it isn't SMF friendly...
Dreamhost is a terrible host for things like the rssbot
It will probably be an fsock problem and you will need to redo the code to get it to work.
Does this support multiple news feeds per a defined forum ?
where can i get the most stable code for this addon ?
It seems everyone is complaining! I got it to work though it took a bit of doing (someone at my host was being "clever" when they set things up and it took a bit to figure out). Still, less than 30 minutes to get it up amd working correctly. This is a very excellent mod. Thank you and thanks for the support (it was all helpful). ;D
same as anywhere rand.
people are good enough to submit hacks and most of the posts are complaining it dosent work.
Glad you got it working.
I'm not sure if I was one of the complainer's or not, but I did get this working on one host, but not on my other site hosted by DreamHost.
So, I can say it's a great mod, but I can't get it working, and since I have little php skills, I do need help installing it on my Dreamhost account.
That is why I listed this post in the Paid/Free Help wanted portion of this site:
http://www.simplemachines.org/community/index.php?topic=86261.0
Since I can't get it working I will pay someone to help me get it working. I do appreiate the efforts of the people that submit mods, but I have to work within my limited skillset when it comes to PHP and have to rely on other people that know PHP.
Thanks!
Jamie
Issues :
The posts that my 'forum bot' makes are not searchable. I don't know if this is because I have so many mods installed or what.
The posts that my 'forum bot' makes from yahoo! finance have the correct subject, which reflects the news headline, but the body of the post is a link to the .html file on yahoo's site. It'd be nice if the bot could capture the entire rss body and post it, in its entirety, inside my forum, from yahoo! finance. I understand that this is probably because of the way yahoo formats their rss feeds, however, it'd be real spiffy I could capture the entire body of the headline. In paricular, this is because I want to have rss news on certain companies that my members consider to be popular. For example, http://biz.yahoo.com/iw/060523/0130838.html is the "full" news from company PBLS.PK. The feed for the news from
just this particular company is http://finance.yahoo.com/rss/headline?s=pbls.pk . When pbls.php (my own custom version of news.php) grabs the feed from http://finance.yahoo.com/rss/headline?s=pbls.pk , the body of the post inside my forum looks like this :
Quote
http://us.rd.yahoo.com/finance/news/rss/story/*http://biz.yahoo.com/iw/050919/095559.html
When my forum bot makes a post, the "Last post" section of the forum (to the right of the category on the board index) is left blank. While the counter that says "75 posts 75 topics" is updated correctly, the little snippet from the "Last Post" is missing entirely.
I've read trough this thread about a tousand time and I just don't get it...
Get this error:
QuoteWarning: main(XML/RSS.php) [function.main]: failed to open stream: No such file or directory in /home/gangster/public_html/switchboard/news.php on line 12
Fatal error: main() [function.require]: Failed opening required 'XML/RSS.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gangster/public_html/switchboard/news.php on line 12
I get stuck with the RSS.php
Help will be appreciated!
Can someone post an example script? I'm new to MySQL and I'm a bit confused with the database information (I'm used to connecting, not doing whatever it is here).
Somestiems it's not complianing. It's called feedback.
There's a new RSS Injector mod coming out in about a week or two. (Not from me. I don't know how to code.)
It'll make this script obsolete. :)
I hope so, but I can't jump for joy. It's been said a hundred times already, and it's yet to happen.
All I can do is hope.
Jake04 is a cheap person on this site and has deleted my friends site for no reason!
No he did not delete it... read the other topic..
hey wanted to know if this modification is still in developement? would be really interested in it
Thanks
I don't know why but when I execute the php file, I just get an empty page, has anyone found a solution for this problem?
Quote from: nite0859 on June 07, 2006, 12:12:19 AM
There's a new RSS Injector mod coming out in about a week or two. (Not from me. I don't know how to code.)
It'll make this script obsolete. :)
Is there a website we can check the progress on?
Not yet!!... seems to me there is no support for this topic?! Would've been nice to have this feature working though...
If you are really interested in it put up some cash to incentivise a developer.
I am sure if you offer $1000 somone will do it.
Quote from: micksawyer on June 13, 2006, 03:30:47 PM
If you are really interested in it put up some cash to incentivise a developer.
I am sure if you offer $1000 somone will do it.
I'm sure they would but $1000 is a lot, especially since some people got it to work without further development.
I'm just curious if someone faced the exact same problem as I did, being that the php just gives a blank page.
It's not a problem, that's what happens. Read the first pages and you will see that it gives no feedback once done.
This mod is working fine for me.
Thanks for the time taken to post this originally for all of to find and use!!
Sorry... maybe a dumb question... where and how do I get the userID?
Quote from: sanax on June 20, 2006, 03:54:39 PM
Sorry... maybe a dumb question... where and how do I get the userID?
Admin -> Users the ID is listed in your table of users.
or yourdomain.com/index.php?action=viewmembers
Btw, is there any news on the RSS injector mod, I'm about to test the injector script but I read somewhere that someone was making a mod....
Best.
Carla
Quote from: L.G.S on June 14, 2006, 11:16:53 AM
It's not a problem, that's what happens. Read the first pages and you will see that it gives no feedback once done.
Alright but I also get no injection in the forum.
Quote from: micksawyer on June 13, 2006, 03:30:47 PM
If you are really interested in it put up some cash to incentivise a developer.
I am sure if you offer $1000 somone will do it.
It's already done. I've seen it in action and it works wonderfully and elegantly. But the code author, *cough* , is really, really busy. Perhaps he should release it as an unfinished mod and let someone else pick up where he left off. *shrug*
I keep on sacrificing goats, but it doesn't help. I've tried financial bribery, and he won't be bribed. I've offered beer, women, and cigarettes, but still, all to no avail.
Quote from: nite0859 on June 30, 2006, 07:42:54 PM
Quote from: micksawyer on June 13, 2006, 03:30:47 PM
If you are really interested in it put up some cash to incentivise a developer.
I am sure if you offer $1000 somone will do it.
It's already done. I've seen it in action and it works wonderfully and elegantly. But the code author, *cough* , is really, really busy. Perhaps he should release it as an unfinished mod and let someone else pick up where he left off. *shrug*
I keep on sacrificing goats, but it doesn't help. I've tried financial bribery, and he won't be bribed. I've offered beer, women, and cigarettes, but still, all to no avail.
Women! You did not offer such thing!
For those complaining about how this mod has to have seperate news files, mine does not, it stores in the DB, and no real settings to edit as long as your forum sql data is right.
I might get to this hidden project of mine this weekend, maybe.
For those interested in seeing its progress, just lacking admin interface and packaging...
http://www.mindlesstux.com/forums/index.php?board=14.0
http://www.mindlesstux.com/forums/index.php?topic=1493.msg1514#msg1514
wow
thats really superb
Any update on an RSS Injector that works for everyone?
Eahn time I check someone says in a week it will be done...heheh...
Quote from: Sharjeel66 on February 04, 2006, 11:06:52 PM
here is a more user friendly version...and way of presenting to noobs like me.
http://www.pakeconomist.com//Varius%20Pics/injector.rar
unzip it. (needs winrar) and then open the file news.php in wordpad and edit all the fields which need to be edited.
(upto the source of the feed)
save the file as news.php
and upload it.
then you can open the http://www.yourdomain.etc\injector\news.php
and a blank screen will come....thats it.
go to your forum and check the location you selected. if there are no names then that means you have entered the username and not the userid (which is usualy the number)
any problems...report here.
download not work
what changes i Must do here to work on my forum:
[php]<?xml version="1.0" encoding="iso-8859-1"?><!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=iso-8859-1" />
<title>Stelesys Internet Hosting - Home</title>
<meta name="description" content="Mambo - the dynamic portal engine and content management system" />
<meta name="keywords" content="mambo, Mambo" />
<meta name="Generator" content="Joomla! - Copyright (C) 2005 - 2006 Open Source Matters. All rights reserved." />
<meta name="robots" content="index, follow" />
<link rel="shortcut icon" href="http://www.stelesys.com/images/favicon.ico" />
<!-- Design by Brian Diaz of Media 65 @ http://www.joomlalabs.com All Rights Reserved -->
<meta name="Generator" content="Media 65 - Copyright 1999 - 2005 Design by Brian Diaz of Media 65 @ http://www.m65.net. All Rights Reserved." />
<link rel="stylesheet" type="text/css" href="http://www.stelesys.com/templates/0017_lightbluediv/css/template_css.css" />
<link rel="shortcut icon" href="http://www.stelesys.com/templates/0017_lightbluediv/favicon.ico" />
</head>
<body>
<div id="header">
<h1>Stelesys Internet Hosting </h1>
</div>
<div id="wrapper">
<div id="left">
<table cellpadding="0" cellspacing="0" class="moduletable">
<tr>
<th valign="top">
Services </th>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_content&task=view&id=14&Itemid=27" class="mainlevel" >Colocation</a></td></tr>
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_content&task=view&id=15&Itemid=28" class="mainlevel" >Managed Servers</a></td></tr>
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_content&task=view&id=19&Itemid=31" class="mainlevel" >Web Hosting</a></td></tr>
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_content&task=view&id=22&Itemid=41" class="mainlevel" >Forum Hosting</a></td></tr>
</table> </td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="moduletable">
<tr>
<th valign="top">
Main Menu </th>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_frontpage&Itemid=1" class="mainlevel" id="active_menu">Home</a></td></tr>
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_content&task=view&id=20&Itemid=32" class="mainlevel" >Acceptable Use</a></td></tr>
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_wrapper&Itemid=33" class="mainlevel" >Support</a></td></tr>
<tr align="left"><td><a href="http://www.stelesys.com/index.php?option=com_content&task=blogcategory&id=15&Itemid=42" class="mainlevel" >Projects</a></td></tr>
</table> </td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="moduletable">
<tr>
<td>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="moduletable">
<tr>
<th valign="top">
Login Form </th>
</tr>
<tr>
<td>
<form action="http://www.stelesys.com/index.php" method="post" name="login" >
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<label for="mod_login_username">
Username </label>
<br />
<input name="username" id="mod_login_username" type="text" class="inputbox" alt="username" size="10" />
<br />
<label for="mod_login_password">
Password </label>
<br />
<input type="password" id="mod_login_password" name="passwd" class="inputbox" size="10" alt="password" />
<br />
<input type="checkbox" name="remember" id="mod_login_remember" class="inputbox" value="yes" alt="Remember Me" />
<label for="mod_login_remember">
Remember me </label>
<br />
<input type="submit" name="Submit" class="button" value="Login" />
</td>
</tr>
<tr>
<td>
<a href="http://www.stelesys.com/index.php?option=com_registration&task=lostPassword">
Lost Password?</a>
</td>
</tr>
</table>
<input type="hidden" name="option" value="login" />
<input type="hidden" name="op2" value="login" />
<input type="hidden" name="lang" value="english" />
<input type="hidden" name="return" value="http://www.stelesys.com/content/view/21/34/projects/smfrssinjector.php.txt" />
<input type="hidden" name="message" value="0" />
<input type="hidden" name="9e1a2d1d306a76d3f970bbeb39d0642c" value="1" />
</form>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="moduletable">
<tr>
<td>
<ul id="mainlevel-nav"><li><a href="http://www.stelesys.com/index.php?option=com_contact&Itemid=3" class="mainlevel-nav" >Contact Us</a></li><li><a href="http://www.stelesys.com/index.php" class="mainlevel-nav" >Home</a></li></ul> </td>
</tr>
</table>
</div>
<div id="content">
<div id="date" align="right">Saturday, 15 July 2006</div>
<span class="pathway">Home </span><hr />
<center></center>
<table class="blog" cellpadding="0" cellspacing="0"><tr><td valign="top"><div> <table class="contentpaneopen">
<tr>
<td class="contentheading" width="100%">
Stelesys Internet Hosting </td>
</tr>
</table>
<table class="contentpaneopen">
<tr>
<td valign="top" colspan="2">
<h3>Who is Stelesys?</h3><p>Stelesys Internet has been providing customized web hosting services, specializing in PHP and MySQL since 1999. </p><h3>Why Stelesys?</h3><p>Stelesys understands that no matter how small your site is, it is critical to you. We work extensively with our customers to tailor solutions to meet their needs. We provide a secure and reliable platform to host Internet applications on, as well as extensive security protections for our managed customers.</p><h3>What services does Stelesys offer?</h3><p> Stelesys offers FreeBSD web hosting plans, FreeBSD managed servers and FreeBSD dedicated servers for hosting your Internet applications.</p> </td>
</tr>
</table>
<span class="article_seperator"> </span>
</div></td></tr></table> <div class="back_button">
<a href='javascript:history.go(-1)'>
[ Back ]</a>
</div>
</div>
</div>
<br />
</div>
<div id="footer">
<!-- Note Do not remove design credit Link -->
Contact us! Phone: 678.773.3290 | E-Mail: <a href="mailto:[email protected]">[email protected]</a>
<div align="center">
© 2006 Stelesys Internet Hosting</div>
<div align="center">
<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the GNU/GPL License.</div><a href="http://www.joomlalabs.com" target="_blank" style="color: #FFFFFF">Desinger</a>
</div>
</body>
</html>
<!-- 1152974651 -->[/php]
Quote from: TLM on July 11, 2006, 09:56:28 AM
Quote from: nite0859 on June 30, 2006, 07:42:54 PM
Quote from: micksawyer on June 13, 2006, 03:30:47 PM
If you are really interested in it put up some cash to incentivise a developer.
I am sure if you offer $1000 somone will do it.
It's already done. I've seen it in action and it works wonderfully and elegantly. But the code author, *cough* , is really, really busy. Perhaps he should release it as an unfinished mod and let someone else pick up where he left off. *shrug*
I keep on sacrificing goats, but it doesn't help. I've tried financial bribery, and he won't be bribed. I've offered beer, women, and cigarettes, but still, all to no avail.
Women! You did not offer such thing!
For those complaining about how this mod has to have seperate news files, mine does not, it stores in the DB, and no real settings to edit as long as your forum sql data is right.
I might get to this hidden project of mine this weekend, maybe.
For those interested in seeing its progress, just lacking admin interface and packaging...
http://www.mindlesstux.com/forums/index.php?board=14.0
* Crosses fingers *
I hope so.
Sorry to all. I have been incredibly busy lately. I wil go through the comments on this thread and make some changes according to the feedback and make sure it works with rc2. I can probably have that working pretty quickly depending on what suprises are thrown at me this week.
It'll take me a while to make it a plug-in though. I've had some good thoughts on how to make it work, but they haven't made it out of the "thought" stage yet.
One thing to note: when I was developing this, I noticed that many different rss feeds had slightly different naming conventions for some of the fields. So, it it's not working (save some incompatibility with the latest version), then that is likely the cause.
Feel free to make feature requests here.
Quote from: nite0859 on June 30, 2006, 07:42:54 PM
It's already done. I've seen it in action and it works wonderfully and elegantly. But the code author, *cough* , is really, really busy. Perhaps he should release it as an unfinished mod and let someone else pick up where he left off. *shrug*
I keep on sacrificing goats, but it doesn't help. I've tried financial bribery, and he won't be bribed. I've offered beer, women, and cigarettes, but still, all to no avail.
I can say that no one has tried to bribe me. If they had, it would be done :)
Anyhow, I have been very very busy, and I haven't done anything to prevent someone else from picking it up and running with it. Quite honestly, at the time I made the original post, there was another person (can't recall who now) that was working on a "competing" rss injector. He seemed to have some good ideas and a lot more time than I did, so I faded into the background. I have gotten about 5 emails over the months about people asking for help, mostly around compatibility with RC2, and I've had every intention of responding to them, but my priorities have been elsewhere.
I'm intending to become active again, so hopefully I can make this thing a lot more useable for the masses.
I had no idea there was so much discussion about this thing. I was looking through my list of unanswered email and decided to pull up the original thread, and it is no 12 pages long.
Jerry
i saw that you said that request future here ; so see this:
is there any automatic poster for SMF like this:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffiles.vbulletin.com%2F3.6%2Frssposter-edit.png&hash=d7f3f9fc7d729823261984e55287cd6f1cc36362)
Part 4 - Saturday June 3rd
RSS Poster Robot
vBulletin 3.6 includes a new scheduled task that can check RSS feeds from the internet, read their contents and insert items from them onto your board.
The system is fully flexible, allowing the administrator to fine-tune the items that are inserted using keywords and to control the output of the robot using special templates for both the titles and body text of inserted items, which can be inserted either as threads or as announcements.
Product System: Latest Version Check and Product URL
Products can now be associated with two URLs: the URL to the product's home page and the URL to a special version check page. If a product URL is entered, the title of the product links to that page in the product manager.
The version check URL is slightly more complex. For the version check to function properly, the URL must return text in the form of:
Code:
<version productid="x">1.2.3</version>
With x being the ID of the product and 1.2.3 being the latest version. When a user selects "check version" for the product, the currently installed version is compared against the latest version.
Receive Private Messages from Buddies Only
You may now select to receive private messages only from users on your buddy list. If a non-buddy tries to send you a message, they will receive an error saying that you do not accept private messages. Administrators and moderators are automatically able to bypass this restriction.
"Show Private Forum" Option per Forum
While the "Show Private Forums" option has existed for quite some time, it was only controllable at the entire board level. Now, you may specify what information users without permission to view a forum can see about the forum.
For example, you likely wouldn't want your moderator-only forum to be shown to anyone but moderators. However, if you have a specific forum that only users who bought a subscription can access, you may wish to allow normal users to see the forum name and post counts to entice them to buy a subscription.
Give Reputation Using AJAX
Reputation can now be added to a post without leaving the page. When you click the reputation icon on a post, a box will appear and allow you to choose whether you approve or disapprove of the post and provide a reason.
Error Prevention in Upgrades
Upgrading should now be less painful. The script will automatically detect if you already have the changes necessary and skip trying to add them again. The vast majority of errors that occur during upgrades should no longer happen.
This also helps with long upgrade steps that may timeout on large boards. Should this happen, you can simply refresh the page and the upgrade will continue from the exact place it stopped.
Option to Disable Scheduled Tasks
Default scheduled tasks can no longer be removed, but they can be individually disabled.
Parsed Signature Storage
Signatures are now stored in a parsed format. This increases performance when viewing a thread.
Phrased Items: Scheduled Tasks, Custom Profile Fields, Subscriptions, Holidays
These items are now all phrased so they can be translated into different values per language.
And By Popular Demand...
We have (just) added the ability to sort a forum by thread creation time by default.
That's all for today. We hope you like what we've announced so far and I'll be back tomorrow with another batch of features to show you.
__________________
All good things to those who wait.
Oops I got married!
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffiles.vbulletin.com%2F3.6%2Frssposter-manager.png&hash=42530e2498622f663a673cb63ede985dd11efe5d)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffiles.vbulletin.com%2F3.6%2Frssposter-edit.png&hash=d7f3f9fc7d729823261984e55287cd6f1cc36362)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffiles.vbulletin.com%2F3.6%2Frssposter-forumdisplay.png&hash=5f545cba4fd51b545a060e073b0a96da237d31eb)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ffiles.vbulletin.com%2F3.6%2Frssposter-postbit.png&hash=24470a8ff18fe77e0b8bd1575e949552ba61af5b)
That is along the lines of what I had in mind ultimately. I suspect there will be a few steps in between.
Quote from: confusion on July 16, 2006, 07:04:09 PM
That is along the lines of what I had in mind ultimately. I suspect there will be a few steps in between.
Ditto, btw, I am the other person. Maybe we should just combine projects seeing how we have similar ideas.
I'm up for that. What do you have in the works?
What I got so far is one script file, using the database, to run thru multiple feeds. It posts as what ever user you set, and to what ever board. It uses a 3rd party script that parses rss feeds rather well, http://magpierss.sourceforge.net/ Right now I am working on the admin interface, and I hit a road block the stored array is not working out rather well...
*edit* forgot to add it has a better method of posting the posts, instead of what appears forcing the messages into the db, I sorta used the functions in smf which do half the work */edit*
Quote from: tarkhorani on July 15, 2006, 10:57:23 AM
Quote from: Sharjeel66 on February 04, 2006, 11:06:52 PM
here is a more user friendly version...and way of presenting to noobs like me.
http://www.pakeconomist.com//Varius%20Pics/injector.rar
unzip it. (needs winrar) and then open the file news.php in wordpad and edit all the fields which need to be edited.
(upto the source of the feed)
save the file as news.php
and upload it.
then you can open the http://www.yourdomain.etc\injector\news.php
and a blank screen will come....thats it.
go to your forum and check the location you selected. if there are no names then that means you have entered the username and not the userid (which is usualy the number)
any problems...report here.
download not work
well until TLM gets a chance to work on the awesome mod he is trying to put together..does anyone have the rar file from the
pakeconomist site?? I would like to implement this and see if does work successfully for me..
Looking forward to this mod and thanks very much for the two who are working on it.
Any updates on the project?
Right now I am shooting for a triple release this coming weekend.
1) Modifications mod, adds a new menu section to admin area for larger mods that outgrow what features and options can offer, (Google Member Map, RSS Injector, and I know of 1 more that would use this)
2) RSS Injector, 0.01, wont be very polished, but functional, just solved a bug thats been plauging me for a while, :)
3) Google Member Map, complete re-write on it to APIv2 and hopefully a couple of new features...
Quote from: TLM on July 25, 2006, 12:26:57 AM
Right now I am shooting for a triple release this coming weekend.
1) Modifications mod, adds a new menu section to admin area for larger mods that outgrow what features and options can offer, (Google Member Map, RSS Injector, and I know of 1 more that would use this)
2) RSS Injector, 0.01, wont be very polished, but functional, just solved a bug thats been plauging me for a while, :)
3) Google Member Map, complete re-write on it to APIv2 and hopefully a couple of new features...
I shall applaud you if this works without anyone getting hurt. :P
Quote from: TLM on July 25, 2006, 12:26:57 AM
Right now I am shooting for a triple release this coming weekend.
1) Modifications mod, adds a new menu section to admin area for larger mods that outgrow what features and options can offer, (Google Member Map, RSS Injector, and I know of 1 more that would use this)
2) RSS Injector, 0.01, wont be very polished, but functional, just solved a bug thats been plauging me for a while, :)
3) Google Member Map, complete re-write on it to APIv2 and hopefully a couple of new features...
Well once it is released I will be glad to test it. :)
Quote from: TLM on July 25, 2006, 12:26:57 AM
Right now I am shooting for a triple release this coming weekend.
1) Modifications mod, adds a new menu section to admin area for larger mods that outgrow what features and options can offer, (Google Member Map, RSS Injector, and I know of 1 more that would use this)
2) RSS Injector, 0.01, wont be very polished, but functional, just solved a bug thats been plauging me for a while, :)
3) Google Member Map, complete re-write on it to APIv2 and hopefully a couple of new features...
awesome!
Quote from: TLM on July 25, 2006, 12:26:57 AM
Right now I am shooting for a triple release this coming weekend.
1) Modifications mod, adds a new menu section to admin area for larger mods that outgrow what features and options can offer, (Google Member Map, RSS Injector, and I know of 1 more that would use this)
2) RSS Injector, 0.01, wont be very polished, but functional, just solved a bug thats been plauging me for a while, :)
3) Google Member Map, complete re-write on it to APIv2 and hopefully a couple of new features...
Please do.
I'd just like to say thanks for this, i've got the early version up and working and had pretty much no problems with it at all.
To give you some context this is what i'm doing:
I have a news / culture site (http://www.leftlion.co.uk) which has an rss feed for latest articles. it's actually built in CFM but we use smf for the forum part of the site (http://www.leftlion.co.uk/forum).
At present there is a seperate article comments section on the main site, but i'd like to pull that out and use smf for comments. So i'm now running the injector to pull new articles into an article comments board (http://www.nottinghamculture.co.uk/leftlion/index.php?board=13.0).
That's all working fine. However if i want to remove the current article comments system i need a way of linking from the article to the topic in the comments board.
So the process would ideally be:
- A new article goes live on the site.
- An xml file is created alongside the article which gets passed to the injector and inserted into smf
- I then want to insert the topic id into the articles database so i can link to it from the article
How would i go about editing the injector to insert the new topic id into the articles database (they are both mysql db's on the same server). is it just a case of locking the db and doing a select max? That doesn't seem very robust to me...
Any help / advise would be massively appreciated!
regards and thanks,
Alan
No matter, i figured out how to do it. very straightforward in the end. i canexplain how i did it if anyone is interested.
Lemme guess,
Post new topic in the forum and use ssi_news ssi_boardNews (I think thats what it is) and display from the forum directly on the front page? In the end you have a artical in the forum and on the front page, and the front page you can setup to have # comments link along with add comment.
I'm deffo interested when you get this done, having looked at the first one posted in this topic, I'm not entirely sure it's suitable for a board with 2.1 million posts.
Looking forward to this aswell!
Just read an article about the advantages of RSS feeds on your site ;)
When is the mod version coming out. He keeps saying "in a week". Also, I want to make a forum posts automatically after I make an update on my site. This is possible, but it is annoying. Is it possible to stop the bot from posting the liunk to the original article? It is double linking, one made by me and the other made by it.
In the meantime can someone please explain how I can que these up into a db, have it filter by keywords and then post only the postings that have those keywords in the sentences.
Quote from: TLM on July 11, 2006, 09:56:28 AM
Quote from: nite0859 on June 30, 2006, 07:42:54 PM
Quote from: micksawyer on June 13, 2006, 03:30:47 PM
If you are really interested in it put up some cash to incentivise a developer.
I am sure if you offer $1000 somone will do it.
It's already done. I've seen it in action and it works wonderfully and elegantly. But the code author, *cough* , is really, really busy. Perhaps he should release it as an unfinished mod and let someone else pick up where he left off. *shrug*
I keep on sacrificing goats, but it doesn't help. I've tried financial bribery, and he won't be bribed. I've offered beer, women, and cigarettes, but still, all to no avail.
Women! You did not offer such thing!
For those complaining about how this mod has to have seperate news files, mine does not, it stores in the DB, and no real settings to edit as long as your forum sql data is right.
I might get to this hidden project of mine this weekend, maybe.
For those interested in seeing its progress, just lacking admin interface and packaging...
http://www.mindlesstux.com/forums/index.php?board=14.0
....maybe without the packaging? I'm itching to get it myself....
any developments?
I guess the dev decided to keep it all for himself...
Oh, I seriously doubt he's keeping just for himself. More than likely "it'll be done by this weekend, probably" is what he expects, and then life comes in and screws up the schedule. I can wait.
The other injector, if you HAVE TO have one right now, works....but...like it's been said, it takes a little to set it up. I got it working, so....it can't be too hard.
TLM, love your other mods! This one's gonna be freakin' huge when it's done.
Quote from: jkrlvgn on August 06, 2006, 09:20:23 AM
Oh, I seriously doubt he's keeping just for himself. More than likely "it'll be done by this weekend, probably" is what he expects, and then life comes in and screws up the schedule. I can wait.
We have a winner folks.... This really comes into effect when preping to move about 350mi...
Quote from: jkrlvgn on August 06, 2006, 09:20:23 AM
TLM, love your other mods! This one's gonna be freakin' huge when it's done.
Note to others:
the more you annoying him with it, the less motivated he's gonna be to do it.
Quote from: Xarcell on August 07, 2006, 09:32:13 AM
Note to others:
the more you annoying him with it, the less motivated he's gonna be to do it.
Oh..I thought it usually worked the opposite.
Quote from: Sharjeel66 on February 04, 2006, 11:06:52 PM
here is a more user friendly version...and way of presenting to noobs like me.
http://www.pakeconomist.com//Varius%20Pics/injector.rar
unzip it. (needs winrar) and then open the file news.php in wordpad and edit all the fields which need to be edited.
(upto the source of the feed)
save the file as news.php
and upload it.
then you can open the http://www.yourdomain.etc\injector\news.php
and a blank screen will come....thats it.
go to your forum and check the location you selected. if there are no names then that means you have entered the username and not the userid (which is usualy the number)
any problems...report here.
I think problem with account. Pl check.
Quote from: Cool Surfer on August 07, 2006, 04:20:54 PMI think problem with account. Pl check.
This probably means they either didn't pay the bill or are over their bandwidth limit.
any updates?
thank you for working on this :) I was looking for this.
The thread is getting a bit confusing. Does any one know which link is working? Thanks.
Everyone have patience! I want this mod too but the longer we wait the better it will be.
I used the original code from the first few pages, but now the links which helped me do not work so I cannot reuse it :(
When you follow the original link to the supposed rss injector mod, there's nothing there.
On page two somebody reposted it and it worked
Are you sure? I just followed the link on page 2 to the .rar file and it's broken.
Not it's not to a rar file
http://www.stelesys.com/projects/smfrssinjector.php.txt
I don't think he's going to release it. He's had a working copy for a while AND has it installed on a live board. That was weeks ago. He's not giving it uop so let's just stop asking.
'd be happy if someone could just repost how to do the original script properly, because I'm in need of something like this real fast..
I don't know if it'll help anyone, but I hacked a quick one together using simplepie RSS.
I'm using it very successfully at http://www.lordifans.com/forum/index.php?action=collapse;c=6;sa=expand#6 (http://www.lordifans.com/forum/index.php?action=collapse;c=6;sa=expand#6)
Download the RSS from here http://simplepie.org/ (http://simplepie.org/) and forget about the PEAR XML/RSS.I don't have time to support it but feel free to use it. I'm not responsible if it breaks your server or your smf installation.
<?php
//
// SMF RSS Injector by Jerry Bell - [email protected]
// Based on the Joomla RSS import script by Max Soukhomlinov, [email protected]
//
//
//
// This script is quick and dirty. Please remember to abide by the RSS content providers' terms of use.
// Modified to use simplepie by Shawn Herrin [email protected]
/** the simplepie RSS library is required */
require("./includes/simplepie/simplepie.inc");
/** DATABASE Configuration */
define("DB_HOSTNAME",""); //Insert your DB server name here
define("DB_USERNAME",""); //DB username here
define("DB_PASSWD","*"); // DB password here
define("DB_DATABASE",""); //DB name here
$sSql = "";
$userid = 3; //Set this to the SMF userid you want the messages posted from
$boardid = 21;//Set this to the id of the board you want to post the messages in
$sUrl = "http://yourdomain.com/feed";
$feed = new SimplePie();
$feed->feed_url($sUrl);
$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(20);
for ($x = 0; $x < $max; $x++)
{
$item = $feed->get_item($x);
$sSql = "SELECT
COUNT(ID_MSG) AS link_match
FROM smf_messages
WHERE subject = '". addslashes($item->get_title()) ."'";
$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 ($int_count['link_match'] == 0)
{
$titletext = addslashes($item->get_title());
$maintext = "<p>" . $item->get_date('j M Y') . "</p><p>" . addslashes($item->get_description()) . "</p><p><a href=\"" . $item->get_permalink() . "\">" . $item->get_permalink() . "</a></p>";
echo("*******************************************************************<br />");
echo("title: " . $titletext . "<br />");
echo("*******************************************************************<br />");
$sSql = "INSERT INTO smf_topics
(
ID_BOARD,
ID_MEMBER_STARTED,
ID_MEMBER_UPDATED
)
VALUES
(
'$boardid',
'$userid',
'$userid'
)";
mysql_query($sSql,$obj_db) or die(mysql_error());
$topic = mysql_insert_id();
$postertime = date('U');
//Insert the actual message
$sSql = "INSERT INTO smf_messages
(
subject,
body,
ID_MEMBER,
ID_BOARD,
ID_TOPIC,
posterTime
)
VALUES
(
'". $titletext ."',
'". $maintext ."',
'$userid',
'$boardid',
'$topic',
'$postertime'
)";
mysql_query($sSql, $obj_db) or die(mysql_error());
$messageid = mysql_insert_id();
//Go back and set ID_FIRST_MSG and ID_LAST_MSG in the topics table
$sSql = "UPDATE smf_topics
SET ID_FIRST_MSG = '$messageid',
ID_LAST_MSG = '$messageid'
WHERE ID_TOPIC = '$topic'";
mysql_query($sSql, $obj_db) or die(mysql_error());
//Increment total posts for board
$sSql = "UPDATE smf_boards
SET numPosts = numPosts + 1,
numTopics = numTopics + 1
WHERE ID_BOARD = '$boardid'";
mysql_query($sSql, $obj_db) or die(mysql_error());
//Increment Total Messages
$sSql = "UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalMessages'";
mysql_query($sSql,$obj_db) or die(mysql_error());
//Increment Total Topics
$sSql = "UPDATE smf_settings
SET value = value + 1
WHERE variable = 'totalTopics'";
mysql_query($sSql, $obj_db) or die(mysql_error());
// Increment post count for user record
$sSql = "UPDATE smf_members
SET posts = posts + 1
WHERE ID_MEMBER = '$userid'";
mysql_query($sSql, $obj_db) or die(mysql_error());
}
else
{
echo("There is already a match<br />");
}
}
}
if ($obj_db) {
@mysql_close($obj_db);
}
?>
It's really interesting and thank you for the job!
But as a total noob can you just explain a bit more what we must do?
1. download the tool at simplepie.org
2. install the needed files on the server in a simplepie directory
3. create a php file and copy/paste (and of course adapt) your script
4. where do you save this php file?
5. what is the name of this php file?
Anyhow your work is exactly what I'm looking for!
Great script, it works but I have 2 questions:
when I run it, I get this:
Warning: ./cache/http%3A%2F%2Fnews.google.com%2F%3Fned%3Dus%26topic%3Dt%26output%3Drss.spc is not writeable in /home/tscar/public_html/board/RSS/simplepie.inc on line 1252
And how would I be able to limit the width the post can go, because it is seriously screwing up my post display.
Edit:
Also how do I stop the topics coming up as new topics since last visit? When my members go on the forum they cannot remove them from the list by marking all read and the on/off button always stays on for new posts.
Ok so we only need to run the adapted scipt, but.... how can you update the board automatically? I mean, when a new feed is coming, you have to run the script once again to add the newest news, no?
Also, all the feeds are added in an ascending manner, the top news is the latest news, the bottom news is the newest.
Are you asking me?
To do them automatically you need to set up a cron job.
Your last part does not make sense, you say the top news is the latest, and the bottom is the newest, although these things are one and the same.
I mean when I ran the script it creates me 20 new topics.
-> The topic in the top of the board section was the oldest news of the feed.
-> The topic in the bottom of the board section was the newest news of the feed.
Normally, the newest topics are on top...not on bottom. That's what I mean :-\
I'm not sure then, it works fine for me.
Some sad news on my part of my injector people want.
The hd where it was stored died in my recent move, so I lost the admin panel. But the code for the injector and its db lived else where, so that is still alive. I am contimplating on if I should just release the code now and come back later with a full mod when I have time or not.
Quote from: L.G.S on August 31, 2006, 07:09:50 AM
Great script, it works but I have 2 questions:
when I run it, I get this:
Warning: ./cache/http%3A%2F%2Fnews.google.com%2F%3Fned%3Dus%26topic%3Dt%26output%3Drss.spc is not writeable in /home/tscar/public_html/board/RSS/simplepie.inc on line 1252
And how would I be able to limit the width the post can go, because it is seriously screwing up my post display.
Edit:
Also how do I stop the topics coming up as new topics since last visit? When my members go on the forum they cannot remove them from the list by marking all read and the on/off button always stays on for new posts.
Ok, I forgot about that caching thing. You have two options. Create a ./cache directory in the same dir that you are running the script from and change it's permissions to be writable. OR add the following line right after the $feed->feed_url($sUrl); line
$feed->enable_caching(false);
As far as stopping the topics from coming up as new, I have no idea. I don't know SMF at all.
As far as the making the titles shorter, try this.
Save the following code to your server in the same directory as your news script as smart_trim.php.
<?php
#################################################
####
#### smart_trim
#### This function trims a string to a specified length.
#### Words are separated by space characters, and they are not
#### chopped if possible.
####
#### @package smart_trim
#### @author Michael Gauthier <[email protected]>
#### silverorange
#### labs.silverorange.com
####
#### Copyright (c) 2003, silverorange Inc.
#### All rights reserved.
####
#### Redistribution and use in source and binary forms, with or without modification,
#### are permitted provided that the following conditions are met:
####
#### * Redistributions of source code must retain the above copyright notice, this
#### list of conditions and the following disclaimer.
#### * Redistributions in binary form must reproduce the above copyright notice,
#### this list of conditions and the following disclaimer in the documentation
#### and/or other materials provided with the distribution.
#### * Neither the name of silverorange Inc. nor the names of its contributors may
#### be used to endorse or promote products derived from this software without
#### specific prior written permission.
####
#### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#### ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#### WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#### IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
#### INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#### BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#### DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#### LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
#### OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
#### OF THE POSSIBILITY OF SUCH DAMAGE.
####
#################################################
/**
* Trim the string.
*
* @param string $text The line to trim.
* @param integer $max_len The maximum length of the trimmed line.
* This ignores the length of the characters
* that indicate trimming has occured.
* @param boolean $trim_middle Trimming takes place in the middle of the line
* iff true. Otherwise, the line is trimmed at the
* end. Defaults to false.
* @param string $trim_chars Characters to use to indicate trimming has
* occured. Defaults to '...'.
*
* @return string The trimmed line of text.
*/
function smart_trim($text, $max_len, $trim_middle = false, $trim_chars = '...')
{
$text = trim($text);
if (strlen($text) < $max_len) {
return $text;
} elseif ($trim_middle) {
$hasSpace = strpos($text, ' ');
if (!$hasSpace) {
/**
* The entire string is one word. Just take a piece of the
* beginning and a piece of the end.
*/
$first_half = substr($text, 0, $max_len / 2);
$last_half = substr($text, -($max_len - strlen($first_half)));
} else {
/**
* Get last half first as it makes it more likely for the first
* half to be of greater length. This is done because usually the
* first half of a string is more recognizable. The last half can
* be at most half of the maximum length and is potentially
* shorter (only the last word).
*/
$last_half = substr($text, -($max_len / 2));
$last_half = trim($last_half);
$last_space = strrpos($last_half, ' ');
if (!($last_space === false)) {
$last_half = substr($last_half, $last_space + 1);
}
$first_half = substr($text, 0, $max_len - strlen($last_half));
$first_half = trim($first_half);
if (substr($text, $max_len - strlen($last_half), 1) == ' ') {
/**
* The first half of the string was chopped at a space.
*/
$first_space = $max_len - strlen($last_half);
} else {
$first_space = strrpos($first_half, ' ');
}
if (!($first_space === false)) {
$first_half = substr($text, 0, $first_space);
}
}
return $first_half.$trim_chars.$last_half;
} else {
$trimmed_text = substr($text, 0, $max_len);
$trimmed_text = trim($trimmed_text);
if (substr($text, $max_len, 1) == ' ') {
/**
* The string was chopped at a space.
*/
$last_space = $max_len;
} else {
/**
* In PHP5, we can use 'offset' here -Mike
*/
$last_space = strrpos($trimmed_text, ' ');
}
if (!($last_space === false)) {
$trimmed_text = substr($trimmed_text, 0, $last_space);
}
return remove_trailing_punctuation($trimmed_text).$trim_chars;
}
}
/**
* Strip trailing punctuation from a line of text.
*
* @param string $text The text to have trailing punctuation removed from.
*
* @return string The line of text with trailing punctuation removed.
*/
function remove_trailing_punctuation($text)
{
return preg_replace("'[^a-zA-Z_0-9]+$'s", '', $text);
}
?>
Add
include ("smart_trim.php");
to the top of your news script
Then in your news script just change the line
$titletext = addslashes($item->get_title());
to
$titletext = smart_trim(addslashes($item->get_title()), 50, false, "...");
Where 50 is the max length of the title and ... is the characters to append to the end of the cut.
Additionally, change the following query as well.
$sSql = "SELECT
COUNT(ID_MSG) AS link_match
FROM smf_messages
WHERE subject = '". addslashes($item->get_title()) ."'";
to
$sSql = "SELECT
COUNT(ID_MSG) AS link_match
FROM smf_messages
WHERE subject = '". smart_trim(addslashes($item->get_title()), 50, false, "...") ."'";
I don't know if this works, I didn't do it on mine, just hoping to offer an option.
Thanks for the help,
but, I meant the post itself, not the title. The content of the post stretches the page and makes sigs unreadable.
What exactly does creating the cache directory do?
Nicely done, herrin.
One thing I'd suggest as an enhancment though would be to use SMF's createPost function to actually post the message rather than direcly putting it into the database.
Yes that's what I forgot to say, it would be nice if the posts were actually added to the overall post count / topic count.
Quote from: L.G.S on August 31, 2006, 01:48:48 PM
Thanks for the help,
but, I meant the post itself, not the title. The content of the post stretches the page and makes sigs unreadable.
What exactly does creating the cache directory do?
Ahhhh, you could apply the same function to the get description on this line to chop it.
$maintext = "<p>" . $item->get_date('j M Y') . "</p><p>" . addslashes($item->get_description()) . "</p><p><a href=\"" . $item->get_permalink() . "\">" . $item->get_permalink() . "</a></p>";
The simplepie caching mechanism is to make sure you aren't overloading the feed. Like if you pull from a feed everytime a page is viewed, this will cache it and expire it so you aren't hitting the feed everytime. For this though I don't think that's a desired feature as I assume you want to see new items everytime you run your script.
Quote from: Ben_S on August 31, 2006, 02:25:15 PM
Nicely done, herrin.
One thing I'd suggest as an enhancment though would be to use SMF's createPost function to actually post the message rather than direcly putting it into the database.
I didn't do anything I just stood on the shoulders of whoever wrote it first. :)
If you have a link to some documentation or explanation of the createPost function I would love to use that instead as there are some inconsistencies doing it with the method it's currently using.
Not sure of any documentation but the function itself is pretty simple to use, have a look in Subs-Post.php for createPost.
Basically if you just include SSI.php in your injector file you should be able to call createPost with the required variables. Having included SSI.php, SMF should deal with connecting to the database etc.
I should add that the createPost function is 1.1x feature.
Also see http://www.simplemachines.org/community/index.php?topic=48529.msg348548#msg348548
Quote from: Ben_S on August 31, 2006, 02:56:38 PM
Not sure of any documentation but the function itself is pretty simple to use, have a look in Subs-Post.php for createPost.
Basically if you just include SSI.php in your injector file you should be able to call createPost with the required variables. Having included SSI.php, SMF should deal with connecting to the database etc.
I should add that the createPost function is 1.1x feature.
Also see http://www.simplemachines.org/community/index.php?topic=48529.msg348548#msg348548
You the bomb in phantoms yo. I'm 10 minutes from having it working. I'll post it shortly, by the way, using that function works MUCH better!
http://www.mindlesstux.com/rss_injector.phps
http://www.mindlesstux.com/rss_injector.sql
For those that like what I have done with mine. You will need to get MagpieRSS (http://magpierss.sourceforge.net/) and extract it to a MagpieRSS directory in your forum dir. Then simply load the sql into the same table with your forum, and edit the feeds, I think the fields are self explanitory. I am not going to make this into a mod, someone can if they like, but I dont have time to make a admin panel like I had before the hd crash.
Quote from: Ben_S on August 31, 2006, 02:56:38 PM
Basically if you just include SSI.php in your injector file you should be able to call createPost with the required variables. Having included SSI.php, SMF should deal with connecting to the database etc.
I think you have to include Subs-Post.php as well for it to work. Or at least for me I did.
Hey herrin, your script is seriously screwin my pages up lol.
Check here:
http://www.ruthlessintent.com/board/index.php?topic=8930.0
Login with: JTCM
Password: helper
New version using a safer native SMF function. createPost()
Apparently this only works in SMF 1.1.
USE AT YOUR OWN RISK. IT COULD SCREW UP YOUR FORUM. IT WORKS FINE FOR ME, BUT THAT MEANS NOTHING. I CAN'T HELP YOU IF IT SCREWS UP YOUR FORUM.
<?php
/*
SMF FEED / RSS INJECTOR by Shawn Herrin - [email protected]
This script will grab a feed or even autodetect feeds and inject them into the
SMF forum of your choice.
This script is based on the great work done by:
- SMF RSS Injector by Jerry Bell - [email protected]
** I don't know whether this is secure or unsafe or what. I don't support it
it's a quick hack to get a feature I need. It could hose your SMF db. Who knows.
Use with caution and at your own risk.
*/
error_reporting(E_ALL);
require("./includes/simplepie/simplepie.inc");
// these need the full path to your SMF files
require_once('/home/user/public_html/forum/SSI.php');
require_once('/home/user/public_html/forum/Sources/Subs-Post.php');
/** DATABASE Configuration */
define("DB_HOSTNAME","localhost"); //Insert your DB server name here
define("DB_USERNAME",""); //DB username here
define("DB_PASSWD","*"); // DB password here
define("DB_DATABASE",""); //DB name here
// initialize variables ** Don't touch these.
$sSql = "";
$aryMsgOptions = Array();
$aryTopicOptions = Array();
$aryPosterOptions = Array();
// set variables ** Modify these to match your board
$iUserId = 0; // Set this to the SMF userid you want the messages posted from
$iBoardId = 0; // Set this to the id of the board you want to post the messages in
$sRealName = ""; // **Not quite sure - I believe this allows you to override the realname of the $iUserId specified
$sEmailAddr = ""; // **Not quite sure - I believe this allows you to override the email address of the $iUserId specified
$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://yourfeed.com/rss"; // This is the feed to fetch.
$iMaxItemsToRetrieve = 5; // This is the max number of feed items to retreive.
// Instantiate SimplePie object
$feed = new SimplePie();
$feed->feed_url($sFeedUrl);
$feed->enable_caching(false);
$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);
// 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 = '". addslashes($item->get_title()) ."'";
$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 = addslashes($item->get_title());
//$sItemTitle = smart_trim(addslashes($item->get_title()), 50, false, "...");
$sItemBody = "<p>" . $item->get_date('j M Y') . "</p><p>" . addslashes($item->get_description()) . "</p><p><a href=\"" . $item->get_permalink() . "\">" . $item->get_permalink() . "</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);
}
?>
Do I need any rss.php extra files?
edit: nevermind I got it thanks
Quote from: L.G.S on August 31, 2006, 03:57:15 PM
Hey herrin, your script is seriously screwin my pages up lol.
Check here:
http://www.ruthlessintent.com/board/index.php?topic=8930.0
Login with: JTCM
Password: helper
That sucks, try the new one, otherwise, not sure what's causing it. My guess is the formatting from the feed. Don't know, mine works fine so far.
Now that TLM is back, I won't be updating mine anymore. I wasn't trying to step on you, just hadn't seen any working versions and wanted to post for anyone who needed one.
TLM could you give more information about the editing parts?
So I've sent the Magpie folder, but do I need any other files? It talks of SSI.php and some other stuff.
And where do I enter the username, password, feed URL, etc?
Quote from: herrin on August 31, 2006, 04:04:02 PM
Quote from: L.G.S on August 31, 2006, 03:57:15 PM
Hey herrin, your script is seriously screwin my pages up lol.
Check here:
http://www.ruthlessintent.com/board/index.php?topic=8930.0
Login with: JTCM
Password: helper
That sucks, try the new one, otherwise, not sure what's causing it. My guess is the formatting from the feed. Don't know, mine works fine so far.
Yeah same with the new one, it causes the bg colours to mess up and everything
The RSS mod is one of the ones I am really looking forward to. Just to use to make the forum look more active and to give topics for people to comment on.
Quote from: herrin on August 31, 2006, 04:05:50 PM
Now that TLM is back, I won't be updating mine anymore. I wasn't trying to step on you, just hadn't seen any working versions and wanted to post for anyone who needed one.
No big deal, I wanted to make a whole mod on this one, I have several ideas but its looking like I wont have time. I figured I better release what I got, seeing how it seems to be the better so far, for supporting multiple feeds/posters/boards.
Quote from: haktanir2 on August 31, 2006, 04:10:52 PM
TLM could you give more information about the editing parts?
So I've sent the Magpie folder, but do I need any other files? It talks of SSI.php and some other stuff.
And where do I enter the username, password, feed URL, etc?
(assuming your forum is at /forum)
1. copy the .phps code into a text file, save as a .php and place in /forum
2. dload magpierss, and place everything in it at /forum/MagpieRSS
3. dload the sql file, and use something like phpmyadmin to load the table into the forum database
4. go back to the table you just now imported and the feilds are rather descriptive in themselves. Just add rows with the desired information.
5. Make a cronjob or what ever to run the script, eg in linux,
0 */4 * * * php /homedirectory/forums/rss_injector.php
would run the script every 4 hours. Note you will have to alter your path to the script as needed.
6. Enjoy hopefully.
If I ever have time that are not involved with life, priorities are to finsh the google maps mod then finsh this one. Although I would not mind if someone made this into a mod using my code, as long as they credited me for what is due.
Looks good TLM, I'll probably make use of yours in a couple of weeks when I'm back from holiday.
Quote from: Ben_S on August 31, 2006, 04:26:04 PM
Looks good TLM, I'll probably make use of yours in a couple of weeks when I'm back from holiday.
Hehe, no prob there, have a beer for me too. (The holiday is bday for me, and I dont plan on celerbrating it, but rather reading about 60 pages of small print books for one class)
I thin I have TLM mods implemented, how can I check to see if its working correctly?
Load the rss_injector.php and if you get nothing back, should have. Then go check the forum. Or wait till the server hits one of the 4th hour points (if thats what you set it up as).
works nicely, now I just need to figure out where I can have that user id set to have admin approve the postings first before putting it on the board.
Hey guys, how would I make the topics/posts add to the daily stats??
I don't understand on how to get this to work.
Where do I enter in my xml feed I want it to use? Also the board id and user id?
Quote from: o_1281 on September 01, 2006, 09:14:48 AM
works nicely, now I just need to figure out where I can have that user id set to have admin approve the postings first before putting it on the board.
No feature of that exists.
Quote from: L.G.S on September 01, 2006, 11:10:54 AM
Hey guys, how would I make the topics/posts add to the daily stats??
My injector should do that automatically
Quote from: Xarcell on September 02, 2006, 11:56:10 AM
I don't understand on how to get this to work.
Where do I enter in my xml feed I want it to use? Also the board id and user id?
The sql table you should have installed.
No it doesn't,
by daily stats I mean like each day:
http://www.ruthlessintent.com/board/index.php?action=stats
I've injected at least 30 topics today but nothing show up on today's:
Total Topics: 3
Can you post an example of an edit in the mysql table.
I do not know mysql, but can prolly figure it out.
Quote from: L.G.S on September 02, 2006, 12:58:26 PM
No it doesn't,
by daily stats I mean like each day:
http://www.ruthlessintent.com/board/index.php?action=stats
I've injected at least 30 topics today but nothing show up on today's:
Total Topics: 3
Hrm noted your on rc3, maybe something changed on that fact, I might have some time later I might look into this.Ah that feature I never really liked.... Umm... Not sure, but if I get free time I will see what I can do....
Quote from: Xarcell on September 02, 2006, 01:04:40 PM
Can you post an example of an edit in the mysql table.
I do not know mysql, but can prolly figure it out.
Install phpmyadmin and navagate to the table and insert the rows as desired...
Or read the insert line in the sql file.
OK then I get ya.
I know this isn't the thread but you seem helpful and I don't want to waste space making another one:
What could I do to make the stats of each day / month for admins only?
Dont think there is a way to do that with out throwing code in a template.
Damn ok, thanks.
I used/edited .sql
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (2, 2, 1, 'http://rss.slashdot.org/Slashdot/slashdot', 1157028360);
imported it into my databse via myphpadmin
I visited the url pointing to the .phps file.
I got nothing. Did I do it right?
When you put in the rss_injector.php (make sure you take off the S), it'll come up with a blank page still. SO..if you saw nothing, then it's right.
I had a question, though....is there anyway to get the whole story instead of just the linkback and the description?
I get these errors:
Warning: main(MagpieRSS/rss_fetch.inc): failed to open stream: No such file or directory in /home/.abigaildryer/xarcell/xarcell-studios.com/demo/RC3-9.5/rss_injector.php on line 11
Warning: main(MagpieRSS/rss_fetch.inc): failed to open stream: No such file or directory in /home/.abigaildryer/xarcell/xarcell-studios.com/demo/RC3-9.5/rss_injector.php on line 11
Fatal error: main(): Failed opening required 'MagpieRSS/rss_fetch.inc' (include_path='.:/usr/local/lib/php') in /home/.abigaildryer/xarcell/xarcell-studios.com/demo/RC3-9.5/rss_injector.php on line 11
Xarcell: Did you download the MagpieRSS files? You need those, and they need to be in a directory called "MagpieRSS" specifically. Just the extlib folder and the files ending in .inc need to be in the folder.
It works fine for me...except for my previous question, which isn't a nonworking problem, just an option I'd like to have.
If you need to know where to download the MagpieRSS files, I think there's a link in TLM's post. If there isn't, I know you can google MagpieRSS and get it from the direct site.
Ok I'm a dummy. I had the Mag dir inside a magdir.
I get the blank page now like I'm supposed to. However it does not work for me. As all other feeds I have tried. No errors, no nothing. I think it has something to do with my host dreamhost. They are very SMF unfriendly...
Ugh. *kicks Dreamhost for them*
Anyway, I knew it was something that you just overlooked, because you're usually the one that helps out with like...everything.
Basically what I did:
Made a member (BoardBot! 1.0), copied his id# (372)
Made a board (RSS TEST), copied the boardid (45)
then went into rss_injector.sql and changed everything accordingly:
Quote--
-- Table structure for table `smf_rssfeeds`
--
CREATE TABLE IF NOT EXISTS `smf_rssfeeds` (
`ID` int(11) NOT NULL auto_increment,
`MEMBER_ID` int(11) NOT NULL default '372',
`BOARD_ID` int(11) NOT NULL default '45',
`RSS_FEED` text NOT NULL,
`LAST_UPDATE` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `smf_rssfeeds`
--
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (1, 10, 1, 'rssfeedaddresshere', 1157028360);
I kept the feed address (highlighted in yellow) with slashdot, because I just wanted to see it work. To add more feeds, you just do it via the phpMyAdmin, and add as many rows as you need. If you mess up on the row, just reset the "last update" to 0, then try it again.
Did you make sure to make a member to post the feeds? And, also, did you change it in the .sql file? If you forgot to import it into phpMyAdmin (which I did like...5 times), just click on the SQL tab and copy/past the code into there.
Acks. I'm trying to cover all the bases here too....but...since you haven't been able to see any results yet, I think it's probably the last part....you have to import the sql into your database too, manually.
Lemme know if that works? If not, maybe make a temp account, and I can set it up for you?
Ok, I'm getting ALOT closer to getting this to work.
Right now I cannot seem to get it to post in the right board. My member ID is 2, and my board ID is 2, but it keep posting it in in board ID 1.
my sql:
--
-- Table structure for table `smf_rssfeeds`
--
CREATE TABLE IF NOT EXISTS `smf_rssfeeds` (
`ID` int(11) NOT NULL auto_increment,
`MEMBER_ID` int(11) NOT NULL default '2',
`BOARD_ID` int(11) NOT NULL default '2',
`RSS_FEED` text NOT NULL,
`LAST_UPDATE` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `smf_rssfeeds`
--
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (2, 2, 1, 'http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml', 1157028360);
Is that right?
That LOOKS right...
...where's your board at? Is it the one that's at "xboxnarc.com"?
Ugh.... I hate late night parties....
Quote from: Xarcell on September 04, 2006, 12:41:58 PM
Right now I cannot seem to get it to post in the right board. My member ID is 2, and my board ID is 2, but it keep posting it in in board ID 1.
--
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (2, 2, 1, 'http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml', 1157028360);
Problem,
ID | MEMBER ID | BOARD ID | ... |
2 | 2 | 1 | ... |
Note the ID feild is 2, and BOARD ID is 1. ID is just a thing to keep the rows seperate and have an index to work with. ID should auto-incrment, but if it does not, make sure its the next # in line.
Quote from: jkrlvgn on September 03, 2006, 01:41:36 AM
I had a question, though....is there anyway to get the whole story instead of just the linkback and the description?
If you want to format it, it will take a little php know how, there is a spot to where you can format it, but what your asking for will probally have two diffrent fields in the array of data so you would have to find them in the array. I just used a generic setup for most people that would work.
...how much did you want again to make it post with the full story? *points to Paypal*
I honestly don't know much about coding...just following instruction, and...usually fixing something that I've totally screwed up (like installing Joomla on a safemoded server....ugh!).
Anyway...if it's something that I can find myself (if you don't want to do it), just lemme know where to look... I'm just ecstatic that it works, and wasn't all that much trouble to install!
That was another thing I overlooked. Sorry... I did get it working properly though, thanks!
I feel dumb today.
Also, is there anyway to modify it so that it select a certain post icon, instead of the default "note" one? That would be a nice feature.
EDIT: yep, it's pretty easy to install, just gotta pay attention, lol...
I also intend to run multiple feeds, to different boards. Should I create different tables for each with the proper sql, or can I add another row to the insert with the proper board id?
I also noticed that the post text is really small. Anyway to modify this?
edit:
I added this to the sql file for import:
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (2, 2, 3, 'http://rss.teamxbox.com/news/latest.rss', 1157028360);# Affected rows: 1
It seems to work as well.
Just add another row, and just change the board ID (if posting to another board), I think.
Ya, it seems to work beautifully. Nice to see a rss injector that works with my host.
To change how it looks, its in the code, look for the bbc tag [ p r e ],
To change the icon, its one of those options in there somewhere.
...and...from there, I'm lost. I don't see either in the rss_injector.php file.
sorry, [ t t ]
was thinking in html not bbc.
Which file?
Also, I'm trying to insert multiple feeds. Only 2 of 6 seem to be working. I get this error when I run the php file:
QuoteFatal error: Only variables can be passed by reference in /home/.abigaildryer/xarcell/xboxnarc.com/MagpieRSS/rss_parse.inc on line 343
Is it the feeds themselves causing that error?
Here's what I use:
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (1, 4, 66, 'http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (2, 4, 35, 'http://rss.teamxbox.com/news/latest.rss', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (3, 4, 69, 'http://scripts.ign.com/rss/ign.Xbox360.2.0.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (4, 4, 70, 'http://www.achieve360points.com/rss.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (5, 4, 67, 'http://www.gametrailers.com/rss/newestxb360.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (6, 4, 68, 'http://www.xbox360fanboy.com/rss.xml', 1157028360);# Affected rows: 1
Yeah I tried it also, the sql code gives errors. Probably doesn't work on all servers.
Quote from: haktanir2 on September 05, 2006, 06:44:53 AM
Yeah I tried it also, the sql code gives errors. Probably doesn't work on all servers.
You may need to import the file, not edit it in the myphpadmin. If you edit it, it will give errors. You must import...
Quote from: Xarcell on September 05, 2006, 08:31:22 AM
Quote from: haktanir2 on September 05, 2006, 06:44:53 AM
Yeah I tried it also, the sql code gives errors. Probably doesn't work on all servers.
You may need to import the file, not edit it in the myphpadmin. If you edit it, it will give errors. You must import...
I entered the sql thing in mysql and it did not like it.
Quote from: Xarcell on September 04, 2006, 04:15:19 PM
Which file?
Also, I'm trying to insert multiple feeds. Only 2 of 6 seem to be working. I get this error when I run the php file:
QuoteFatal error: Only variables can be passed by reference in /home/.abigaildryer/xarcell/xboxnarc.com/MagpieRSS/rss_parse.inc on line 343
Is it the feeds themselves causing that error?
Here's what I use:
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (1, 4, 66, 'http://rss.gamespot.com/misc/rss/gamespot_updates_xbox_360.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (2, 4, 35, 'http://rss.teamxbox.com/news/latest.rss', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (3, 4, 69, 'http://scripts.ign.com/rss/ign.Xbox360.2.0.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (4, 4, 70, 'http://www.achieve360points.com/rss.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (5, 4, 67, 'http://www.gametrailers.com/rss/newestxb360.xml', 1157028360);# Affected rows: 1
INSERT INTO `smf_rssfeeds` (`ID`, `MEMBER_ID`, `BOARD_ID`, `RSS_FEED`, `LAST_UPDATE`) VALUES (6, 4, 68, 'http://www.xbox360fanboy.com/rss.xml', 1157028360);# Affected rows: 1
You want to make sure that the feeds are not RSS 2.0, as MagpieRSS doesn't seem to work with that....or at least, that's what I found on the website. A few of my feeds didn't work either, but...it's the parser problem, not so much the script.
As soon as it's upgraded (and it will be, check the website), then I would recommend just uploading the updated files.
If I'm wrong, then...lemme know.
Quote from: haktanir2 on September 05, 2006, 12:46:14 PM
Quote from: Xarcell on September 05, 2006, 08:31:22 AM
Quote from: haktanir2 on September 05, 2006, 06:44:53 AM
Yeah I tried it also, the sql code gives errors. Probably doesn't work on all servers.
You may need to import the file, not edit it in the myphpadmin. If you edit it, it will give errors. You must import...
I entered the sql thing in mysql and it did not like it.
What I did, basically, was copy and paste the entire SQL into phpMyAdmin. The only other thing you can do is try to import it, but...if you had the same problem that I did, you'll have to copy and paste directly.
If the data took and was put into the DB then the next problem should be, does magpie actually parse the feed? I have run into feeds that look right but were not and magpie barfed on them.
What you might want to do is look at the examples magpie gives you, one I think shows what magpie gets out of the feed, and test the problem four feeds to see if its a problem with the feed or the injector.
(Had a couple feeds refuse to "Inject")
I tried to paste the sql and got errors. I had to delete the table and import the file everytime I made changes to get it to work.
Is there any way to have the bot grab the ENTIRE news feed?
It depends on what the feed gives....
Some feeds only give a sentance at most, then others give the whole paragraph(s).
Now if the feed is doing both, I dunno, due to I have not encountered any like so...
Is anyone working on finishing this?
Quote from: TLM on August 31, 2006, 03:22:02 PM
http://www.mindlesstux.com/rss_injector.phps
http://www.mindlesstux.com/rss_injector.sql
For those that like what I have done with mine. You will need to get MagpieRSS (http://magpierss.sourceforge.net/) and extract it to a MagpieRSS directory in your forum dir. Then simply load the sql into the same table with your forum, and edit the feeds, I think the fields are self explanitory. I am not going to make this into a mod, someone can if they like, but I dont have time to make a admin panel like I had before the hd crash.
Quote from: Ben_S on August 31, 2006, 02:56:38 PM
Basically if you just include SSI.php in your injector file you should be able to call createPost with the required variables. Having included SSI.php, SMF should deal with connecting to the database etc.
I think you have to include Subs-Post.php as well for it to work. Or at least for me I did.
Thanks for that, works perfectly with the RSS feed from our blog.
Quote from: TheBlackKnight on September 15, 2006, 07:28:51 PM
Is anyone working on finishing this?
If I ever have time again...
Anyone find what to modify to change the icon selected on the posts? I browsed through the files and didn't see anything.
Have a look at the post.php in the SMF sources dir and look at how that calls createPost.
Quote from: Xarcell on September 25, 2006, 07:58:35 PM
Anyone find what to modify to change the icon selected on the posts? I browsed through the files and didn't see anything.
I did not try to change the icon but quick grep in the sources dir, reveals that on the $msgOptions array, add something like, 'icon' => "thumbup",
That might work, untested, and just off the top of my head during a break on studies.
K, it too me a minute to figure what you guys were talking about. I don't know any php.
However I think I figured it out by following your instructions.
In rss_injoector.php under "$msgOptions" I added this line: 'icon' => 'thumbup',
It seems to work.
Thanks guys...
Does anyone have time to make this into a mod?
Quote from: TLM on August 31, 2006, 03:22:02 PM
http://www.mindlesstux.com/rss_injector.phps
http://www.mindlesstux.com/rss_injector.sql
For those that like what I have done with mine. You will need to get MagpieRSS (http://magpierss.sourceforge.net/) and extract it to a MagpieRSS directory in your forum dir. Then simply load the sql into the same table with your forum, and edit the feeds, I think the fields are self explanitory. I am not going to make this into a mod, someone can if they like, but I dont have time to make a admin panel like I had before the hd crash.
Quote from: Ben_S on August 31, 2006, 02:56:38 PM
Basically if you just include SSI.php in your injector file you should be able to call createPost with the required variables. Having included SSI.php, SMF should deal with connecting to the database etc.
I think you have to include Subs-Post.php as well for it to work. Or at least for me I did.
Well, I want to thank TLM for this great script. It is working nice and fast :) But, this script doesn't work when the feed charset is other than UTF-8.
I have searched Google about this problem and I have found some information about it. The charset problem comes from PHP itself. There are some temporary solutions for using some piece of code to transform the non-UTF-8 charset to UTF-8 but I couldn't find a way to implement them into this script at least for now.
People using MagpieRSS to fetch RSS feeds are having this kind of problems also... Of course, in different applications.
Maybe this script can be modified for use in different charsets (I mean rss_injector.php, not MagpieRSS)
TLM, may I have a very very little request for you? Is it possible to modify your rss_injector.php for using non-UTF-8 RSS feed charsets? If you have time of course... If you don't have time to do, it doesn't matter.
In any case, thanks for your efforts. :)
Regards... - Sindorf
Give me a non utf-8 feed and i'll poke at it when I have time...
/me roams back to books for classes...
Quote from: haktanir2 on October 01, 2006, 07:45:54 AM
Does anyone have time to make this into a mod?
To be honest, your better off using it as it is, you aren't going to want to change your feeds that often, and if you do, it's easy via phpMyAdmin and you won't have to wait for a new version every time you upgrade etc.
Quote from: TLM on October 01, 2006, 11:18:09 PM
Give me a non utf-8 feed and i'll poke at it when I have time...
/me roams back to books for classes...
Thanks TLM :)
I am giving some feeds in my native language.
http://tools.ntvmsnbc.com/rss/TECH.xml
http://www.aa.com.tr/rss/ajansguncel.xml
1st one is a television channel's (such as CNN International) RSS feed about latest Technology news.
2nd one is a local news agency. Also they have news feeds in English (http://www.aa.com.tr/rss/ajansgunceleng.xml)
I also want to provide an UTF-8 feed. In this feed, special characters (such as apostrophes or commas) cannot be seen (for example "Sindorf's White Jacket" is shown as "Sindorf?s White Jacket") Also some additional characters, which can be found in ISO-8859-9 character set, are sometimes problematic.
The feed is: http://rss.hurriyet.com.tr/rss.aspx?sectionId=12
In addition, I want to provide a feed which is written in Japanese. This is also a non-UTF-8 RSS feed, as far as I think.
http://japanese.engadget.com/rss.xml
Maybe it is better to help you a bit more. I am providing you a link, in which some guy has developed a way to fetch non-UTF8 characters using MagpieRSS.
http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
I couldn't manage to solve the problem, using the provided help in the above link. But maybe it can help you find a solution quicker.
Thank you for your interest in solving this problem :) I am very grateful to you :)
Edit: I have an idea. How about changing the RSS fetching system? :) I mean, is it possible to use other PHP RSS parser script? For example, SimplePie (http://simplepie.org/) Maybe it is better (and maybe more easier) to use SimplePie for non-UTF8 charsets... What do you think about it?
SimplePie does look nice.
I was looking at magpie and it hasn't been updated in over a year, and clearly it has issues that need fixing.
QuoteGive me a non utf-8 feed and i'll poke at it when I have time...
... any progress with non utf-8 feeds yet?
Quote from: simonm on October 09, 2006, 03:25:46 PM
QuoteGive me a non utf-8 feed and i'll poke at it when I have time...
... any progress with non utf-8 feeds yet?
Midterms right now, give me till end of the week before I can start to really look at this.
Quote from: TLM on October 09, 2006, 05:17:43 PM
Quote from: simonm on October 09, 2006, 03:25:46 PM
QuoteGive me a non utf-8 feed and i'll poke at it when I have time...
... any progress with non utf-8 feeds yet?
Midterms right now, give me till end of the week before I can start to really look at this.
no hurry... just keep up with the good work on this... and good luck with the midterms...
Thanks for the MOD TLM
The only problem i have was the cron job, just a quick search on google resolved that
See it in action here using bbc rss feeds : http://www.englishfootball.me.uk/football/index.php?board=3.0
anyone figured out why it doesn't show the Last Post in the forum index to the right in each category?
Quote from: RRasco on October 26, 2006, 01:10:42 PM
anyone figured out why it doesn't show the Last Post in the forum index to the right in each category?
I am gonna assume your talking about the first one made by someone else, and not mine. Last check mine does that.
where is yours at? i saw you reference it in alot of the posts, but didnt see a link to it.
http://www.simplemachines.org/community/index.php?topic=62121.msg709129#msg709129
thx TLM. how often does this update? and how? any cron jobs needed?
can someone make this a mods pleeese :P
There is no need to make it a mod really. It's very simple.
Quote from: Xarcell on November 01, 2006, 04:14:50 PM
There is no need to make it a mod really. It's very simple.
Ok since everyone has go this down...uhm would it be too much to ask for a step by step? Without broken links? :P
http://www.simplemachines.org/community/index.php?topic=62121.msg709129#msg709129
:-\
ok
1. I downloading the magpie file - then uploaded those files to my forum directory into a folder called MagpieRSS
2. ? I see his 2 links but how do I download those?
http://www.mindlesstux.com/rss_injector.phps
http://www.mindlesstux.com/rss_injector.sql
thnaks for the help :D
Ok so I make a table right
am I doing this right?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg34.imagevenue.com%2Floc542%2Fth_21091_table_122_542lo.jpg&hash=3e38625f9b998193b74ad3056dc10b5a6c21d4a0) (http://img34.imagevenue.com/img.php?image=21091_table_122_542lo.jpg)
thansk frot the help!
In phpMyAdmin, you should be able to go to SQL and uplaod the sql file and it takes care of that for you.
I get this when I tryi to import the rssinjector.sql text file ( I saved that link up top as a sql file right)
Error
SQL query:
--
-- Table structure for table `smf_rssfeeds`
--
CREATE TABLE IF NOT EXISTS `smf_rssfeeds` (
`ID` int( 11 ) NOT NULL AUTO_INCREMENT ,
`MEMBER_ID` int( 11 ) NOT NULL default '0',
`BOARD_ID` int( 11 ) NOT NULL default '0',
`RSS_FEED` text NOT NULL ,
`LAST_UPDATE` int( 11 ) NOT NULL default '0',
PRIMARY KEY ( `ID` )
) ENGINE = MYISAM AUTO_INCREMENT =2 DEFAULT CHARSET = latin1 AUTO_INCREMENT =2;
MySQL said: Documentation
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=2' at line 8
YOu need to drop the table smf_rssfeed. Then try to import the sql file again.
Ok I looked over my tables 5 times I cannot find any table smf_rssfeed. I never made one either as the other one wasn't saved (my pic up top). ::) >:(
I wrote some instructions on how to add the rss_injector, and how to tweak it with Tiny Portal.
http://www.tinyportal.net/smf/index.php?topic=10239.0
Hey that was awemsome write up made it sound much more clear!
But i got this again...I looked still don't have any rss tables to drop though :o
Error
SQL query:
--
-- Table structure for table `smf_rssfeeds`
--
CREATE TABLE IF NOT EXISTS `smf_rssfeeds` (
`ID` int( 11 ) NOT NULL AUTO_INCREMENT ,
`MEMBER_ID` int( 11 ) NOT NULL default '0',
`BOARD_ID` int( 11 ) NOT NULL default '0',
`RSS_FEED` text NOT NULL ,
`LAST_UPDATE` int( 11 ) NOT NULL default '0',
PRIMARY KEY ( `ID` )
) ENGINE = MYISAM AUTO_INCREMENT =2 DEFAULT CHARSET = latin1 AUTO_INCREMENT =2;
MySQL said: Documentation
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=2' at line 8
Gonna go on a limb, and very tired limb at that, but it might be something with version diff of MySQL?
You could try to create the table by hand if you like, but i have to much on my plate right now to help with that.
/me goes back to working on papers for class
ok I tried it on anoter server space and it went through no errors... :D\
BUT... when I ran injector with yahoo rss news feed
I got
Warning: main(MagpieRSS/rss_fetch.inc): failed to open stream: No such file or directory in /home/tgnabe2z/public_html/smf/rss_injector.php on line 11
Warning: main(MagpieRSS/rss_fetch.inc): failed to open stream: No such file or directory in /home/tgnabe2z/public_html/smf/rss_injector.php on line 11
Fatal error: main(): Failed opening required 'MagpieRSS/rss_fetch.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tgnabe2z/public_html/smf/rss_injector.php on line 11
hi everyone...I was so close any ideas what I need to do :)
Is there anyone here who would install this for a small Paypal payment?
@ Ketchup
Give me the URL of the site you are trying to run it on.
@forumposters
I can try...
Quote from: Xarcell on November 02, 2006, 04:05:18 PM
@ Ketchup
Give me the URL of the site you are trying to run it on.
@forumposters
I can try...
Hi i guess it doesn't matter as the mysql version must not be up to date on the board I want it ???
On my control panel it says:
PHP version 4.4.2
MySQL version 4.0.27-standard
Is there anyway i can manually add the table? If so can someone help me with the feilds in the pic i posted above
Thanks!
Here are some reasons why i'd like to see this as an official smf mod
1st, i don't like the idea of playing around in phpmyadmin anytime i want to add an rss link, i'm just so afraid of messing around with the tables unless it's absolutely necessary.
2nd, i'd like to eventually allow moderators or special board members to add rss links if they want....maybe even have regular members submit or suggest an rss link for mods/admins to consider....
3rd, it would be nice to configure the posts that the 'bot' makes...ie, colors, fonts, signature etc.
4th, as a mod, it will be up for constant updates and revisions in the future by other coders.
I think that this idea has great potential and would greatly benefit the smf community.
I like the simlar mod that vbulletin has...
if somebody could look at that....
You don't need to touch phpmyadmin if you use the file based RSS script a few pages back. All you do is modify the file with your username and link etc and you open it and it's done.
can you please direct me to that page? ;D
i got the hack to work nicely ;) but it would stil be nice to see this as a mod, as is, this is a very very very cool feature.....
Also,
**UPDATE**
??? I'm trying to set the cron job to have the rss_injector.php run automatically like posted earlier
but, i get the following message emailed back to me:
/home/*****/******/rss_injector.php: line 1: ?php: No such file or directory
/home/*****/******/rss_injector.php: line 3: //: is a directory
/home/*****/******/rss_injector.php: line 4: syntax error near unexpected token `dirname'
/home/*****/******/rss_injector.php: line 4: `@include_once(dirname(__FILE__) . '/SSI.php');'
what does that mean? When I run the script manually, it's fine....i only get this message for cron jobs.... is the script still working?** I figured this out, never mind..... but so that others can learn from my mistake... i set the cron job as
Quote0 */4 * * * /XXXXX.com/rss_injector.php
where it should have been
Quote0 */4 * * * php /XXXXX.com/rss_injector.php
duh, :P
s
I have got TLM'S to work great... ty very much
One issue I am having and i have no expierence with cron is getting it to run.
I named the file inject.php and from my browser it runs fine....
Here is the last error I got from the cron job
/home/sprintcu/public_html/sportsforum/inject.php: line 1: ?php
: No such file or directory
/home/sprintcu/public_html/sportsforum/inject.php: line 2:
: command not found
/home/sprintcu/public_html/sportsforum/inject.php: line 3: //: is a directory
/home/sprintcu/public_html/sportsforum/inject.php: line 4: syntax error near unexpected token `dirname'
/home/sprintcu/public_html/sportsforum/inject.php: line 4: `@include_once(dirname(__FILE__) . '/SSI.php');
'
Then I renamed it to rss_injector to see if that made any difference, and get this from the cron job
/bin/sh: /home/sprintcu/public_html/sportsforum/rss_injector.php: Permission denied
I am getting the following error when I run TLM's injector:
QuoteFatal error: Call to undefined function: createpost() in /homepages/41/d87694803/htdocs/palmettoshutterbugs/forum/rss_injector.php on line 113
And here is that portion of the rss_injector.php (I think):
QuotecreatePost($msgOptions, $topicOptions, $posterOptions);
I'm running SMF1.0.8 but will be updating to 1.0.9 as soon as I get this sorted out (one thing at a time, ya know). Any help would be greatly appreciated.
Cheers,
Patrick
Quote from: dupont24 on November 12, 2006, 12:57:33 PM
I named the file inject.php and from my browser it runs fine....
Ok....
Quote from: dupont24 on November 12, 2006, 12:57:33 PM
/home/sprintcu/public_html/sportsforum/inject.php: line 1: ?php
: No such file or directory
/home/sprintcu/public_html/sportsforum/inject.php: line 2:
: command not found
/home/sprintcu/public_html/sportsforum/inject.php: line 3: //: is a directory
/home/sprintcu/public_html/sportsforum/inject.php: line 4: syntax error near unexpected token `dirname'
/home/sprintcu/public_html/sportsforum/inject.php: line 4: `@include_once(dirname(__FILE__) . '/SSI.php');
'
Then I renamed it to rss_injector to see if that made any difference, and get this from the cron job
/bin/sh: /home/sprintcu/public_html/sportsforum/rss_injector.php: Permission denied
Do you have command line access to your host? Also are you setting up the cron job with
php rss_injector.php
Note the cmd php infront of the script.
Quote from: pihutch on November 14, 2006, 09:57:54 AM
QuotecreatePost($msgOptions, $topicOptions, $posterOptions);
I'm running SMF1.0.8 but will be updating to 1.0.9 as soon as I get this sorted out (one thing at a time, ya know). Any help would be greatly appreciated.
Not possible to upgrade to 1.1 rc3? I never poked 1.0.8/9 at all with this so I dont know if it will work at all.
I haven't had any success in upgrading to RC1.1/1.3. I can't get the dang tables to convert correctly and I really don't have that much time to work around it, so I am just sticking with 1.0.8/9 until I absolutely have to upgrade. Is this something you can look into working out for 1.0.8/9?
Cheers,
Patrick
Like you my friend, time is my enemy as well... Otherwise I would.
Thanks anyway, TLM. Does anyone else have any idea what is causing this error? I'm assuming that the createpost function is not a valid command in 1.0.x, but I have no idea what it should be.
Cheers,
Patrick
Quote from: TLM on November 14, 2006, 10:32:19 AM
php rss_injector.php
Note the cmd php infront of the script.
I am trying this from cpanel I am with Bluehost and I have really no clue as to what I should be putting in the command line.
I thought i was to put a path to the file.
So I tried : sportsforum/inject.php and other various forms.....and I take it that is in correct....lol
Calling the url up in the browser works great so I thought that a cron job just basically called up the url.
What should i put in the command line.
Thanks for your help......And thanks for this great mod......now if i could only get google to index smf better.....I just switched from Vbulletin and already I can see indexing is going to be an issue......Google is not reading the posts...oh well different topic not for here....
I've been trying to get this RSS injector to work for some time now, it just does not want to work so I gave up on the idea until someone can make a mod of it.
With all the complicated mods made for SMF, it just surprises me that no one still made a mod of this. It's a great concept and I'd probably pay to have this mod if I could be sure it would work.
ok, so I got this mod working a while back. its TLMs version. and it works great. i dont know if this can even be made into a mod because it requires you to install magpieRSS as well as do something with pear. I dont even remember all the steps I did but it was pretty complex in getting it to work. I am going to try and refresh my memory as to what I did to get it to work to help out. If there is an easy way to make it a mod, I am going to try and do it, but I am still pretty new to PHP. Attached is my cronjob I use to update the feeds. You may be having permissions problems(obviously). CHMOD it to allow write access read and execute access for all.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fs170193323.onlinehome.us%2Fpics%2Frssinjectorcronjob.gif&hash=8b507ca47614708a6f7117fe893705ef4eb40629)
Is this available in a mod yet? I will definately beta test any such mod for rss injection.
Why should it be a mod? Honestly its not that hard to install, there is no code modification and only a simple sql setup which should be almost self explanatory. If anything all that should be done is for a better documention on how to set it up properly. I see no point in making this a mod package for SMF as it weeds out those that don't understand the script. I have seen peoples boards where they simple installed every package they could, and then asked what does it do, and complain it does not do what they wanted. By not putting this into a package, I am saving myself the grief of this, either educate your selves some to understand simple instructions on how to install it, or don't use it.
RRasco, whats wrong with calling the php script via a cli php instead of attempting to "browse" to the script? The only advantage you would get is that you would fill your logs with when the script was called is all I can see. Is GET even a vaild cli cmd in linux/bsd boxes? I know of wget thats it.
dupont24, you have to understand the concept of where the cronjob would start for you if you dont like playing around with paths till it works. Most companys would dump you in something like a root folder for your site which has something like public_html, public_ftp, etc... inside public_html you put your website. Once you figure out where they start you off at, call that home. From there you figure the path to the script, eg
/home/mindless, is my websites home directory, but the script is in public_html/forums/rss_injector.php. So for a cron job I have two possible options to keep things simple.
*/4 * * * * php public_html/forums/rss_injector.php
or
*/4 * * * * php /home/mindless/public_html/forums/rss_injector.php
note how I setup the paths in both examples, both would work just as well. Adding > /dev/null to the end of both cmds/crons would be ideal if you dont want spam from the cron system.
Whom ever suggested I use simplePie, I have poked at it some and have a test version that works mostly, just a few small things here and there I need to be sure that work before I post the newer script. Also you may have noted the old link some pages back I posted is broken, I will be fixing that sometime here in the near future.
Quote from: TLM on November 24, 2006, 10:00:54 PM
Whom ever suggested I use simplePie, I have poked at it some and have a test version that works mostly, just a few small things here and there I need to be sure that work before I post the newer script.
That was me :)
Thanks for your work TLM...
Thanks for the nice injector TLM, got it working with a bit of polish to have it insert text in correct codepage (but that was magPIE's fault, fixed by adding iconv to _cdata parser there).
Outstanding work on this code. I have it running at Arkansas Sports Talk (http://www.arsportstalk.net/smf) under the user NewsHound. I'm using the MagPie version, but would love to change over to SimplePie when it's offered.
I do have a request. Some of the feeds we use will duplicate posts. This is especially true when an article is a breaking news article. It gets published once it breaks, but then, they either update the story to fill in more details or make some other tweak. Since the check is by date, the story gets injected again. I would like to see some sort of way, whether matching on the article title or the like, that I can avoid this. I've thought about adding the code myself but time and my newness to SMF have prevented me from doing so.
Thank you very much for paving the way. This has helped our site tremendously in keeping fresh content going on the site.
Quote from: georgepdog on November 30, 2006, 12:35:00 PM
I do have a request. Some of the feeds we use will duplicate posts. This is especially true when an article is a breaking news article. It gets published once it breaks, but then, they either update the story to fill in more details or make some other tweak. Since the check is by date, the story gets injected again. I would like to see some sort of way, whether matching on the article title or the like, that I can avoid this. I've thought about adding the code myself but time and my newness to SMF have prevented me from doing so.
Iv accually thought about this for the same reason, just no time right now to really sit down and hash out an idea for that...
Good work on the mod. How about someone make a new topic with the links to download it and how to install it so people don't have to search through 20+ pages? Just a suggestion. :)
Quote from: Sindorf on October 01, 2006, 09:04:58 PM
TLM, may I have a very very little request for you? Is it possible to modify your rss_injector.php for using non-UTF-8 RSS feed charsets? If you have time of course... If you don't have time to do, it doesn't matter.
In any case, thanks for your efforts. :)
Regards... - Sindorf
I'm using the MagPie version and am having the opposite problem. Any UTF-8 feed such as search based feeds from Yahoo or Google do not work at all. If it is an ISO-something or other, it works beautifully.
Latin1 works beautifully georgepdog... (that would be ISO-8859-1) but Latin5 (which is ISO-8859-9) is not working at all...
I have searched a bit about that (shoot google) , and other people are getting some kind of errors like me...
Also some UTF-(a number) links are not working...
Maybe that's a problem of MagpieRSS... (it was updated a year and a month a ago... brrrrr... very old :)) or maybe related with the PHP itself...
Quote from: Sindorf on December 03, 2006, 06:39:09 PM
Latin1 works beautifully georgepdog... (that would be ISO-8859-1) but Latin5 (which is ISO-8859-9) is not working at all...
I have searched a bit about that (shoot google) , and other people are getting some kind of errors like me...
Also some UTF-(a number) links are not working...
Maybe that's a problem of MagpieRSS... (it was updated a year and a month a ago... brrrrr... very old :)) or maybe related with the PHP itself...
Yep. That's been my experience. I think all the ones I've been successful with have been the Latin 1 feeds.
Also, I can't get any feeds through feedburner to work, but I think that has to do with their feeds not having a pubdate to use for the date compare.
I don't want to step on anyone's toes but I have a modified version that:
- Uses SimplePie as the feed parser
- Pulls requested feeds from a DB table (feed url, board id, member id)
- Uses some very basic configuration settings in the php file to control the look of the post
If anyone is interested in this I will upload to my server so you can check it out (have it). If this steps on the toe's of TLM than I didn't mean to and will not make another post on this subject.
By all means, I have little time right now to program/script anymore.
/me passes the torch on...
OK. I will get the code and SQL to build the table up on my server in the morning and post a link here - going to sleep now.
Thanx for all the work you put into it!
I have a slight request or three...
Let us say we pull the requests from WordPress...
1) A URL inside the post isn't pulled - just the text is.
2) If it is already tagged AND you're using the tag system MOD with SMF - can those tags be pulled into the same system?
3) I think that is it BUT it was easy enough for me to do, even easy to setup the CRON jobs. For some it may not be so simple. Is it POSSIBLE to set a 4 hour CRON and/or admin control panel for that?
4) They pull 'em in backwards. A blog post made at 10:00 will show up on the top of a blog post made at 10:05... Buggered if I can figure it out.
That's all I can think of with it.
Oh, crap, multiple feeds in a single file... That'd be nice too.
Quote from: Veign on December 23, 2006, 12:57:04 AM
I don't want to step on anyone's toes but I have a modified version that:
- Uses SimplePie as the feed parser
- Pulls requested feeds from a DB table (feed url, board id, member id)
- Uses some very basic configuration settings in the php file to control the look of the post
If anyone is interested in this I will upload to my server so you can check it out (have it). If this steps on the toe's of TLM than I didn't mean to and will not make another post on this subject.
Sounds great, could I test it ???
Quote from: KGIII on December 23, 2006, 02:45:46 AM
I have a slight request or three...
Let us say we pull the requests from WordPress...
1) A URL inside the post isn't pulled - just the text is.
2) If it is already tagged AND you're using the tag system MOD with SMF - can those tags be pulled into the same system?
3) I think that is it BUT it was easy enough for me to do, even easy to setup the CRON jobs. For some it may not be so simple. Is it POSSIBLE to set a 4 hour CRON and/or admin control panel for that?
4) They pull 'em in backwards. A blog post made at 10:00 will show up on the top of a blog post made at 10:05... Buggered if I can figure it out.
That's all I can think of with it.
Quote from: KGIII on December 23, 2006, 02:46:10 AM
Oh, crap, multiple feeds in a single file... That'd be nice too.
1) Example of this occuring?
2) Huh? tag system mod?
3) Im sorry I am hard ass, if you cant figure out how to setup a cron job, tough cookies...
4) I think I fixed this, for most feeds unless your feed unfixes this...
5) Uh... Have you not bothered to setup my script? Multiple feeds via sql....
Quote from: L.G.S on December 23, 2006, 06:17:27 AM
Sounds great, could I test it ???
Your answer....
Quote from: TLM on December 23, 2006, 01:07:20 AM
By all means, I have little time right now to program/script anymore.
/me passes the torch on...
Quote from: Veign on December 23, 2006, 01:15:30 AM
OK. I will get the code and SQL to build the table up on my server in the morning and post a link here - going to sleep now.
Thanx for all the work you put into it!
I posted the code to:
http://www.veign.com/vrc_codeview.asp?type=web&id=47
Sample board where its working:
http://www.scarymind.com/index.php?board=26.0
Improvements that I need to make:
- Add the date/time stamp back to the DB when a feed was last retrieved (very easy to do just need to do it)
Quote from: TLM on December 23, 2006, 12:25:45 PM
Quote from: KGIII on December 23, 2006, 02:45:46 AM
I have a slight request or three...
Let us say we pull the requests from WordPress...
1) A URL inside the post isn't pulled - just the text is.
2) If it is already tagged AND you're using the tag system MOD with SMF - can those tags be pulled into the same system?
3) I think that is it BUT it was easy enough for me to do, even easy to setup the CRON jobs. For some it may not be so simple. Is it POSSIBLE to set a 4 hour CRON and/or admin control panel for that?
4) They pull 'em in backwards. A blog post made at 10:00 will show up on the top of a blog post made at 10:05... Buggered if I can figure it out.
That's all I can think of with it.
Quote from: KGIII on December 23, 2006, 02:46:10 AM
Oh, crap, multiple feeds in a single file... That'd be nice too.
1) Example of this occuring?
2) Huh? tag system mod?
3) Im sorry I am hard ass, if you cant figure out how to setup a cron job, tough cookies...
4) I think I fixed this, for most feeds unless your feed unfixes this...
5) Uh... Have you not bothered to setup my script? Multiple feeds via sql....
Quote from: L.G.S on December 23, 2006, 06:17:27 AM
Sounds great, could I test it ???
Your answer....
Quote from: TLM on December 23, 2006, 01:07:20 AM
By all means, I have little time right now to program/script anymore.
/me passes the torch on...
Quote from: Veign on December 23, 2006, 01:15:30 AM
OK. I will get the code and SQL to build the table up on my server in the morning and post a link here - going to sleep now.
Thanx for all the work you put into it!
TLM pretty much answered everything.
Also, note I was never able to download TLM's version so I grabbed an earlier version that used SimplePie Feed parser and modified it to suit my needs. So far, its works as I need without any known issues.
I will continue to support the script as needed.
1. The link in my signature - it pulls blog posts from my blog and puts them in the news.
2. http://mods.simplemachines.org/index.php?mod=579 <-- tagging system
http://blog.kgiii.info <-- also has tags
3. I suppose but some people might not be able to figure it out. But, as you say, tough cookies.
4 & 5. Hmm... I'll scroll back through and re-read all the posts but I'm pretty sure it is the one that Veign was using with SimplePie and so I don't think I've installed your script, instead I was posting for/to Veign to whom you'd passed the torch on.
I do believe that your's was at a mindlesstux site? If so then when I went to go download it, it was gone.
1) Did not see any specific examples, but running with the problem, some feeds encase the url in html tags. Could have that disabled, auto linking of urls could also be another factor. My script I did not see any flaw with this.
ex. http://www.tpf-guild.com/forum/index.php?topic=622.0
2) Hrm interesting idea, dunno, all the feeds I played with did not have tagging systems... /me might have something else to do now on tha huge stack of things to look at in free time.
3) Good you see it my way, it helps keep out those that install mods for the sake of installing them. (I know people that do this and it drives me crazy)
4/5) Yeah I moved it and forgot to relink it. I still dont have the sql file remade again but back a few pages someone posted the create table info, just fill in the blanks and set time to 0.
http://www.mindlesstux.com/files/rss_injector.phps
*edit*
--
-- Table structure for table `smf_rssfeeds`
--
DROP TABLE IF EXISTS `smf_rssfeeds`;
CREATE TABLE `smf_rssfeeds` (
`ID` int(11) NOT NULL default '0',
`MEMBER_ID` int(11) NOT NULL default '0',
`BOARD_ID` int(11) NOT NULL default '0',
`RSS_FEED` text NOT NULL,
`LAST_UPDATE` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `smf_rssfeeds`
--
/*!40000 ALTER TABLE `smf_rssfeeds` DISABLE KEYS */;
LOCK TABLES `smf_rssfeeds` WRITE;
INSERT INTO `smf_rssfeeds` VALUES
(0,1,14,'http://www.guildwars.com/newsarchive/rss/news-current.xml',1166836846),
(1,1,14,'http://www.guildwars.com/support/gameupdates/rss/updates-current.xml',1166770029),
(2,1,16,'http://steampowered.com/rss.xml',1166778000);
UNLOCK TABLES;
/*!40000 ALTER TABLE `smf_rssfeeds` ENABLE KEYS */;
The SQL Code for what I have right now on tpfguild.com
*/edit*
Oh Veign,
I just glanced at your code, you might be interested in db_query provided through SSI.php.... Saves a little more work for users to setup things. See the .phps file linked above that will not move.
Quote from: TLM on December 23, 2006, 07:08:58 PM
Oh Veign,
I just glanced at your code, you might be interested in db_query provided through SSI.php.... Saves a little more work for users to setup things. See the .phps file linked above that will not move.
Cool. Will get this replaced out in the next version - sometime late tonight.
I need to sit down and look through the Function list for SMF to see if there is anything I can gain from their code.
Quote from: KGIII on December 23, 2006, 06:51:08 PM
2. http://mods.simplemachines.org/index.php?mod=579 <-- tagging system
http://blog.kgiii.info <-- also has tags
I will have to look at how / if tags are embedded in the feed and if SimplePie parses them out. I'll check into this.
Quick glance the tages are under things like subject and catagory. Now I have no clue as to if simplepie pulls them out.
Quote from: TLM on December 23, 2006, 08:35:27 PM
Quick glance the tages are under things like subject and catagory. Now I have no clue as to if simplepie pulls them out.
I can get access to them with SimplePie.
The problem I have is making RSS Injector dependant, even slightly, on a mod. Also, not sure I want to waste the processing time checking if the mod is installed (not sure there is a simple mechanism for this). What I would rather do is wait for tags to become part of the core SMF code and then add the functionality.
Thanks TLM. I'll take a look at the code later and see what happens.
Here's one such example:
http://forum.kgiii.info/index.php?topic=257.0
(Though it's not your code so I don't expect you to have the answer though, well, you might?)
The line:
Microsoft seeks patent covering Web feed readers | Tech News on ZDNet
Should actually be a link, well it was at the blog...
It was, of course, wrapped in tags and so it only grabbed the text instead of the link.
That and the tagging system is pretty interesting. Getting the two to work together would be a lot like work I suppose.
Quote from: Veign on December 23, 2006, 01:05:09 PM
I posted thde code to:
http://www.veign.com/vrc_codeview.asp?type=web&id=47
Sample board where its working:
http://www.scarymind.com/index.php?board=26.0
Improvements that I need to make:
- Add the date/time stamp back to the DB when a feed was last retrieved (very easy to do just need to do it)
Thanks. :) it works perfectly... i have tried also TLM files but I think I will use this one... 8)
Where is the download for this mod file?
Did you read through any of the posts in this thread?
Check this mod ;)
http://custom.simplemachines.org/mods/index.php?mod=624
I tried the zip file instruction...
but here's where I'm stuck (im a n00b!)
3) Run the rss-injector.sql script against your SMF database in MySQL (delete this file
when completed).
What does this mean?? Just requires me to upload file to the smf_forum table?? if so, then why do i have to delete it?
thanks for help.
Can someone tell me what this means when I run the injector
Warning: main(RSS.php) [function.main]: failed to open stream: No such file or directory in /home/ag8090/domains/blahblahforums.com/public_html/forums/rss_injector1.php on line 12
Warning: main(RSS.php) [function.main]: failed to open stream: No such file or directory in /home/ag8090/domains/blahblahforums.com/public_html/forums/rss_injector1.php on line 12
Fatal error: main() [function.require]: Failed opening required 'RSS.php' (include_path='.:/usr/local/lib/php') in /home/ag8090/domains/blahblahforums.com/public_html/forums/rss_injector1.php on line 12
Quote from: Veign on December 23, 2006, 01:05:09 PM
I posted the code to:
http://www.veign.com/vrc_codeview.asp?type=web&id=47
Sample board where its working:
http://www.scarymind.com/index.php?board=26.0
Improvements that I need to make:
- Add the date/time stamp back to the DB when a feed was last retrieved (very easy to do just need to do it)
Hi,
Is this supposed to update the Forum History part on the Statistics page of the forum?
The script has posted many new topics but the count is still 0 under New Topics....
I'm glad to see that so much has come out of my little script. I really apologize for dumping it and not coming back to help. Life has been quite busy for the past 18 months.
This script uses the createPost function which doesn't seem to update the log_activity table from which the stats page displays the daily stats.
Does someone know how to add the code for this to happen?
Does it work on 1.1.3 ?
Yes
Ok, I've gotten this working well, even modified a bit to suit me. I have it running on a cron job and it is good.
Now, is there a yang to this ying? I want a script that can also run on a cron job and delete the posts specifically created by this one.
Anything around already? I've pulled the RemovePosts2 subs out and it's a lot of back engineering to get there. Hoping not to re-invent the wheel.
Does it work on 1.1.4?
Yes it works on 1.1.4. The issues I am having with it are that it does not update the post count and it does duplicate posts. I also still need and automated post deletion mechanism. I've disabled it for now.
Hello,
I'm pretty familiar with setting up boards and when I run the script manually I get a blank page (from previous posts that's a good thing) but I never get any posts. I have tried in mysql to change the feed to several known updating feeds to no avail.
I've yet to see someone explain exactly which mysql fields to input the variables. If someone could do that I would appreciate. I am using the "default" fields, but maybe that is wrong?
I ran the sql without customizations, which inserted rssfeeds tables just fine.
MemberID I have set to "1" under "default".
BoardID is set to 2, again under "default"
FeedURL is set to a slashdot feed url, again under "default"
(the feed is just a wordpress feec urrently that begins with http//www.site.com/rss.php or whatever- is that ok or must it be an xml file it points to?)
FeedName is also populated, under "default"
Any help you be appreciated!
Bob