1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parsing an XML feed to produce a site map.

Discussion in 'PHP' started by SEbasic, Sep 26, 2004.

  1. #1
    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...
    SEMrush
    Cheers in advance for anyone that thinks they might be able to help...

    SE
     
    SEbasic, Sep 26, 2004 IP
    SEMrush
  2. xml

    xml Peon

    Messages:
    254
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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.
     
    xml, Sep 26, 2004 IP
  3. SEbasic

    SEbasic Peon

    Messages:
    6,318
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ah, nice one mate :D

    I'll give it a go...
     
    SEbasic, Sep 26, 2004 IP
  4. SEbasic

    SEbasic Peon

    Messages:
    6,318
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #4
    OK...

    *chough*

    How do I do that then???

    Like I say - NOOB with PHP
     
    SEbasic, Sep 26, 2004 IP
  5. xml

    xml Peon

    Messages:
    254
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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!
     
    xml, Sep 28, 2004 IP
  6. SEbasic

    SEbasic Peon

    Messages:
    6,318
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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.
     
    SEbasic, Sep 30, 2004 IP