Xecuter 3 Mod Chip - Mortgages - Myspace Comments - Loan Consolidation - Ross Simons Coupons

PDA

View Full Version : Parsing an XML feed to produce a site map.


SEbasic
Sep 26th 2004, 8:56 am
OK... Before I start, I don't know the first thing about PHP.

I am not a programmer, but I would really love to give this project a go myself (I normally have someone else write all this kind of thing for me ;))

SO...

I'm sure that this would be possibe, and have spoken to my programmer guy and he has said that it shouldn't be too hard to do...

What I would like, is to have a script that sits on my server, and parses (Every hour or something) the atom feed provided by blogger.

I would like to pull the url and title of the posts, then write it (If possible) to the bottom of a static HTML file.

Basically, create a dynamic site map...

I would probabally (I imagine anyway), have to write the first part of the site map by hand, because the feed only includes the latest 5 posts...

Does anyone have enough time (or the inclination) to give me a hand with this...

It would be great if I could get this to work, because one if the things that I find most irritating with blogger is the inability to have a site map...

Cheers in advance for anyone that thinks they might be able to help...

SE

xml
Sep 26th 2004, 11:18 am
This is EASY to do mate.

Simply download "Magpie RSS" and follow the instructions, they're pretty straight forward.

It has a built in CACHE functions so its quick too.

SEbasic
Sep 26th 2004, 11:40 am
Ah, nice one mate :D

I'll give it a go...

SEbasic
Sep 26th 2004, 12:01 pm
OK...

*chough*

How do I do that then???

Like I say - NOOB with PHP

xml
Sep 28th 2004, 6:17 am
Include the file:

<?php
include 'rss_fetch.inc';

$feed = fetch_rss("http://www.feedsfarm.com/x/r/2.0-seo");

if ($feed) {
foreach ($feed -> items as $item) {
?>
<a href="<?php echo $item[link]; ?>"><?php echo $item[title]; ?></a><br />
<?php
}
}
?>

That *should* do it!

SEbasic
Sep 30th 2004, 3:54 am
Thanks XML - sorry for the delay in replying...

I'll give this a go. I'm not sure what to do with this really, but I'll play with it a little and see what to do with it.