Page 1 of 1

Help!! and is this possible?? (while loop question)

Posted: Wed Oct 13, 2010 6:00 pm
by pushvolume
I am looking to start a sort of aggregator where I will be pulling RSS feeds from music blogs and having them directly posted onto my (wordpress) blog. The main goal is to have only the anchor tags pulled onto my page, and more specifically, anchor tags containing the extension *.mp3. I know I have to do this inside of the while loop on my blog post, but I am new to PHP and I really do not know where to start.

To visualize, my final idea is to have links to externally hosted music files coming onto my page via RSS from other music blogs, but I would like to cut out all of the <p> <h1> <h2> <img> ect tags (everything but ANCHOR tags) so my page is a very simple music aggregator linking only to music files.

Code: Select all

 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post">
      <div class="entry">

    <?php the_content('Read the rest of this entry &raquo;'); ?>

      </div>
    </div>

<?php comments_template(); ?>
<?php endwhile; ?>

Re: Help!! and is this possible?? (while loop question)

Posted: Wed Oct 13, 2010 6:08 pm
by twinedev
Do you have a sample RSS feed?

Re: Help!! and is this possible?? (while loop question)

Posted: Thu Oct 14, 2010 12:40 am
by s.dot
I believe an RSS feed is XML, right?

file_get_contents() to get the contents of the RSS feed, SimpleXML to traverse the feed contents, and strpos() or stripos() to check for the .mp3 extension.

Re: Help!! and is this possible?? (while loop question)

Posted: Thu Oct 14, 2010 12:48 pm
by pushvolume
here is a sample feed coming from feedburner.. http://feeds.feedburner.com/ChemicalJump

I dont want to seem like a complete dummy but is it possible for you to write a sample chunk of code for me? My while loop is in my original post.. If not, I might be able to figure it out, it will just take me a lot longer.

Thanks for the fast reply as well!

If you dont want to write the code for me can you expand on how I would use simpleXML to traverse the contents and where I would apply strpos() or stripos() to find the extension, and how I would look specifically for that extension??