[Pligg 8.2.0] Submit a feed automatically : The recap

Register an Account
Closed Thread
 
Thread Tools Display Modes
  #11 (permalink)  
Old 03-31-2006, 03:20 AM
dwg dwg is offline
New Pligger
 
Join Date: Mar 2006
Posts: 18
Using Magpierss, here is something quick and dirty that seems to work for me. Not sure how to get the tags inserted, but the rest should work. Just set it up as a cron.

Code:
<?
require('../magpierss/rss_fetch.inc');

include('config.php');
require(mnminclude.'link.php');

$rss_feeds=array (
        array(
                'url'=>"http://digg.com/rss/index.xml",
                'category'=>7,
                'author'=>16,
//              'tags'=>'
        ),
);


echo "<ul>\n";
foreach ($rss_feeds as $feed ) {
$rss = fetch_rss($feed['url']);
echo "<li>Site: ", $rss->channel['title'], "<br>\n";
foreach ($rss->items as $item ) {
        $item['author']=$feed['author'];
        $item['category']=$feed['category'];
 
        $title = $item[title];
        $desc= $item[description];

        echo "<ul>";
        echo "<li>Processing <a href=$url>$title</a></li>\n";
        rss_store($item);
        echo "<li>Finished Processing <a href=$url>$title</a></li><br><br/>\n\n";
        echo "</ul>";

}

echo "</li>";
}
echo "</ul>";


function rss_store($item) {

        $linkres=new Link;

        $edit = false;
        $linkres->get(trim($item['link']));

        if(!$linkres->valid) {
                rss_error($item['link']);
                return;
        }

        if($linkres->duplicates($item['link']) > 0) {
                rss_error($item['url']);
                return;
        }
        $linkres->status='discard';
        $linkres->author=$item['author'];

        $linkres->title=$item['title'];
        $linkres->content=$item['description'];


        $linkres->id=0;
        $linkres->category=$item['category'];
        $linkres->randkey=rand(10000,10000000);
        $linkres->read();
        $linkres->status='queued';
        $linkres->store();
        return;
}

function rss_error($url){
        echo "Skipped $url <br/>\n";
}


?>
  #12 (permalink)  
Old 03-31-2006, 01:17 PM
New Pligger
 
Join Date: Mar 2006
Posts: 18
So I can just name this script whatever I want, change the rss feed source, and run it as a cron?
  #13 (permalink)  
Old 03-31-2006, 03:41 PM
dwg dwg is offline
New Pligger
 
Join Date: Mar 2006
Posts: 18
Yep...although you should have your cron have something like ' >/dev/null 2>&1' at the end so it doesn't capture any of the output. You can add as many rss feed sources as you want, just add an additional array to $rss_feeds.
  #14 (permalink)  
Old 04-03-2006, 03:58 AM
Casual Pligger
 
Join Date: Jan 2006
Posts: 31
nice job dwg
but i want to ask how to set a cron job in Magpie?
  #15 (permalink)  
Old 04-03-2006, 07:32 AM
New Pligger
 
Join Date: Apr 2006
Posts: 1
Xanatos.. Cron is normally available on all Unix and Linux distributions. Here is a nice tutorial about running PHP scripts with Cron

http://www.htmlcenter.com/tutorials/...s.cfm/155/PHP/
  #16 (permalink)  
Old 04-05-2006, 11:14 AM
Casual Pligger
 
Join Date: Jan 2006
Posts: 31
sorry user008 i still dont understanding how to set cron job
could anyone teach me step by step??
  #17 (permalink)  
Old 04-08-2006, 03:10 PM
Casual Pligger
 
Join Date: Jan 2006
Posts: 31
i think i know how to set a cron job now
thx user008
  #18 (permalink)  
Old 04-08-2006, 09:07 PM
Constant Pligger
 
Join Date: Jan 2006
Posts: 191
DWG, with your method, what shows up as the poster?
  #19 (permalink)  
Old 04-10-2006, 12:17 PM
dwg dwg is offline
New Pligger
 
Join Date: Mar 2006
Posts: 18
The poster is whoever's author id you set in the settings for the RSS feed:

$rss_feeds=array (
array(
'url'=>"http://digg.com/rss/index.xml",
'category'=>7,
'author'=>16,
// 'tags'=>'
),
);

So, for the above, whichever user has the id=16 is considered the author.
  #20 (permalink)  
Old 04-20-2006, 04:26 AM
New Pligger
 
Join Date: Apr 2006
Posts: 15
dwg,

Your mod is working great for some feeds and not others. For example:

Works:
http://rss.teamxbox.com/news/xbox-360.rss

Does not work:
http://scripts.gamespy.com/rss/gamespy.PC.2.0.xml

I don't get any error messages on the non working feed. Just a blank page when I send the feed through your mod.

Any ideas?
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto submit story on submit step 3 for god only gnalkit Questions and Comments 3 03-30-2011 01:09 AM
[SOLVED] How to automatically check for updates in rss feed? marcinpl87 Questions and Comments 3 01-14-2010 01:06 AM
Some ideas to build a Pligg site Divisive Cotton Questions and Comments 22 10-22-2009 11:46 AM
RSS Import Feed - Feed Frequency Not working ant560 Questions and Comments 4 03-15-2008 05:31 AM
Import RSS Auto submit feed argh2xxx Questions and Comments 12 09-12-2007 05:02 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development