Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kraad

macrumors newbie
Nov 23, 2011
28
0
Helsinki, Finland
Screen Shot 2013-01-03 at 14.54.41.png
 

EV0LUTION

macrumors 6502
Jul 21, 2008
473
0
Florida
I haven't posted in a while, but here is mine for this month

The news feed at the bottom is a custom PHP script I wrote, if anyone wants it I'll post it.
 

Attachments

  • Screen Shot 2013-01-03 at 15.50.51.jpg
    Screen Shot 2013-01-03 at 15.50.51.jpg
    183.3 KB · Views: 256

EV0LUTION

macrumors 6502
Jul 21, 2008
473
0
Florida
I'm quite interested in the PHP script, if you wouldn't mind sharing it?

Obviously it runs via terminal and you need PHP installed to use it. If you don't have PHP installed just install MAMP and you should be good.

Command:
php feeds.php FeedURL [NumberOfItems]

FeedURL: (required)
The url to the XML or RSS feed to parse

NumberOfItems:
Number of news items to parse. If a number of items isn't given it will parse 10 items in the feed.

Example:
Code:
php feeds.php http://feeds.bbci.co.uk/news/rss.xml 4

PHP:
<?

if(!isset($argv[1])) {

	echo "Supply a feed \n";
	
} else {

	$url = $argv[1];
	
}

$doc = new DOMDocument();
$doc->load($url);

if(isset($argv[2])) {

	$i = $argv[2];	
	$i--;

} else {
	
	$i = 10;
	
}

$j = 1;

foreach ($doc->getElementsByTagName('item') as $node)
{
	
	$title = $node->getElementsByTagName("title")->item(0);
	
    echo "$title->nodeValue";
	
	if($i < $j) {
		
		break;
		
	} else {
		
		echo "  |  ";
		
	}
	
	$j++;
	
      
}

?>
 

EV0LUTION

macrumors 6502
Jul 21, 2008
473
0
Florida
Thanks for the link but I can't seem to get the high resolution version without signing up via a Beta code (& I'd rather not go through the hassle)

Any chance you could upload it here?

Many thanks

Kablam
 

Attachments

  • wallpaper-1990170-2012-11-26-0102.jpg
    wallpaper-1990170-2012-11-26-0102.jpg
    225.2 KB · Views: 175
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.