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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pushvolume
Forum Newbie
Posts: 2
Joined: Wed Oct 13, 2010 5:51 pm

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

Post 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; ?>
Last edited by Weirdan on Thu Oct 14, 2010 2:22 am, edited 1 time in total.
Reason: php tags
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

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

Post by twinedev »

Do you have a sample RSS feed?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

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

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
pushvolume
Forum Newbie
Posts: 2
Joined: Wed Oct 13, 2010 5:51 pm

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

Post 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??
Post Reply