Parsing rss feeds using PHP

software development

#1

I am a PHP newbie and want to learn how to parse rss feeds into my website. I would use Javascript, but I understand php is much better for SEO.

My blog’s rss feeds are ready to go, but I have no php experience. I am not ever sure how to set php up? I do have a good understanding of HTML and know that my website is php enabled with Dreamhost.

Thank you for any help.

Ryan Martin - Windermere Real Estate


#2

There are lots of code samples/tutorials for doing this available on the web; Google could probably provide you with an embarrassment of choices that would meet your needs. :wink:

One caveat is offered in hopes of sparing you frustration and grief: make sure that you do not use code that relies upon allow_url_fopen being enabled in your PHP installation (it is not enabled by deffault on DreamHost), look instead for solutions that use cURL.

Just one such example can be found here. :slight_smile:

–rlparker


#3

Thank you

I think that I am getting closer to figuring it out. I will check out the link that you provided.

Ryan Martin - Windermere Real Estate


#4

You are welcome! In re-reading your initial post, I realize I left out the answer to one of your questions, that might be helpful.

You don’t have to “set up” PHP at all on DreamHost, it is “ready to rock” on all DreamHost accounts by default. All you have to do it write you PHP code and save the file with a “.php” extension, and the DreamHost PHP will run it!

–rlparker


#5

The link that I followed suggested that I also need to add cURL to make this work? Is this true?

Ryan Martin - Windermere Real Estate


#6

Actually, it would be true, except that cURL is already installed and ready to go on DreamHost’s default PHP installations. :wink:

–rlparker


#7

Alright, I REALLY appreciate all of your help on this and I am almost there.

I need to know what to do with the cURL information? Do I paste this in notepad and title the extension .php? If so what do I name the .php file?

I am also unclear on what I need to write in html to call this information.

I should probably be embarrassed as you suggested earlier, but this is killing me. I am having a really tough time figuring it out.

Ryan Martin - Windermere Real Estate


#8

Ryan,

At this point, your questions indicate that you really need to step back a bit and take at least an introductory PHP tutorial, or get a book on PHP. I can’t really undertake to teach you PHP in forum exchanges; it would be just too painful.

Essentially, you create a PHP file in a text editor, enter PHP code into that text file, and save the file with a .php extension.

You FTP that file to your web server, and reference it just like an html file (you can browse to it in a browser, link to it, etc.). The details of how to build a PHP file is what you need to study, or review.

Again, Google will give you lots of good “beginning PHP” resources, and the PHP manual and other resources at php.net are also excellent.

I’m happy to help you with a specific question, but you need to understand a little bit more about the process before that will be of much help. Don’t get discouraged, or in too big a hurry; what you take the time to learn now will be very valuable to you later. :wink:

–rlparker


#9

“The details of how to build a PHP file is what you need to study, or review”

That is a very accurate statement. Thank you again for the help. Hopefully this thread will help someone else too.

Ryan Martin - Windermere Real Estate


#10

If you’re dealing with HTML and you want to embed php directly you can add a handler to your .htaccess file
AddType application/x-httpd-php .htm .html
then paste your php code directly into the html file itself.

... <?php ... ?> ...

If you’re dealing with HTML and would like to ‘call’ specific external segments (let’s call one external.php) into your site you can add this handler to your .htaccess: Addhandler application/x-httpd-php .html .php

And SSI your php content into the HTML:

... < !--#include virtual="/external.php" --> ...

#11

Hi Ryan,

There’s a solution (free) available for download that has good documentation:

http://magpierss.sourceforge.net/

I’m using that on the DigitalVibe News Feeds with very little changes to the code given in the documentation.

I would advise learning as much as you can about php, or if you’re stuck and need to contract a web design & development agency (shameless plug!), then my company could produce a quote for you.

If you’re comfortable learning and doing it yourself, then good luck to you, and feel free to ask any questions here - we’d be more than happy to help!

Cheers,
Karl

web design, development & seo by DigitalVibe


#12

Carl,

I appreciate your help too. I have begun a beginners PHP tutorial and downloaded magpie.

Thank you,

Ryan Martin - Windermere Real Estate