Reply to Re: How to open and read "feed:" in PHP?

Your name:

Reply:


Posted by eastcoastguyz on 12/06/07 06:31

On Nov 30, 8:14 am, taps128 <nstje...@gmail.com> wrote:
> eastcoastguyzwrote:
> > On Nov 30, 1:23 am, taps128 <nstje...@gmail.com> wrote:
> >> eastcoastguyzwrote:
> >>> I'm very new to RSS. I was given a URL that starts with "feed:". I
> >>> want to be able to open this and read in its content into a PHP
> >>> program to produce a report. I'm not interested in converting it to
> >>> HTML.
> >>> Question: Is a URL that starts with feed: output XML?
> >>> Question: How do I open a feed: URL in PHP and parse it?
> >>> Thanks!
> >>> Edward
> >> Open it using fopen, file_get_contects or curl, and read it using
> >> simpleXML, or XMLReader.
>
> > Thanks for your posting.
>
> > I looked at the example for simpleXML on the php.net web site. I was
> > able to get the first example working. So I'm starting to understand
> > how this might work.
>
> > I have some questions. That example.php looks to be XML with a PHP
> > envelope (for lack of a better term) around it and then it has a call
> > to XML with "XML;". Since I'm new to this, that is a little confusing
> > as an example. How would that example be if it was reading from a
> > rss.xml file? And what about the "XML;" call?
>
> > Thanks everyone!
>
> > Edward
>
> It's just a string. You can load an xml file directly from a file if you
> want.
>
> Like this:
> $rss=simplexml_load_file('http://www.somesite.com/rss.xml');
>
> Now you have a SimpleXML object named $rss which you can use to iterate.
> Note that this will work faublosly over small files, but the larger the
> file tho more time SimpleXML will take to read it. That's because
> SimpleXML alows you to navigate the xml tree as you wish, foroward and
> backwards how many times you like. To do so it first builds a tree of
> the file in the servers memory. For big files it takes a lot of time to
> do so.
> If you need just tu parse the file, I'd suggest you to use XMLReader
> which is way faster to use.

Thanks!

What size is considered large? The RSS is running at about 260k. Thank
you.

Edward

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация