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

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

am 29.11.2007 20:14:40 von eastcoastguyz

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

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

am 29.11.2007 21:39:27 von Kailash Nadh

On Nov 29, 7:14 pm, eastcoastguyz wrote:
> 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

Remove the "feed:" portion and replace it with http://... and make it
a standard url. It should work.
Yes, it should be an xml file.

--
Kailash Nadh | http://kailashnadh.name

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

am 30.11.2007 07:23:07 von taps128

eastcoastguyz wrote:
> 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.

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

am 30.11.2007 08:52:08 von eastcoastguyz

On Nov 29, 3:39 pm, Kailash Nadh wrote:
> On Nov 29, 7:14 pm,eastcoastguyz wrote:
>
> > 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
>
> Remove the "feed:" portion and replace it with http://... and make it
> a standard url. It should work.
> Yes, it should be an xml file.
>
> --
> Kailash Nadh |http://kailashnadh.name

Thank you! I see now. What really confused me was that wget and curl
said they didn't support "feed:".

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

am 30.11.2007 08:59:50 von eastcoastguyz

On Nov 30, 1:23 am, taps128 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

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

am 30.11.2007 09:04:00 von luiheidsgoeroe

On Fri, 30 Nov 2007 08:59:50 +0100, eastcoastguyz
wrote:

> On Nov 30, 1:23 am, taps128 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

Just to output with PHP script. This will offcourse not be visible when it
is requested.

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

Check the manual for heredoc syntax.
--
Rik Wasmus

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

am 30.11.2007 12:15:21 von Toby A Inkster

eastcoastguyz wrote:

> Thank you! I see now. What really confused me was that wget and curl
> said they didn't support "feed:".

This is a deliberate choice of the designers of the URI scheme -- indeed
it's the whole point of it. They wanted a way to reference a feed in such
a way that browsers would not attempt to open it.

It's an entirely broken idea. The feed should simply be marked with the
correct MIME type and left up to the user's system to decide whether it
should be opened in the browser or a more specialist application.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 5 days, 17:59.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/11/28/itunes-sharing/

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

am 30.11.2007 14:14:11 von taps128

eastcoastguyz wrote:
> On Nov 30, 1:23 am, taps128 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.

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

am 06.12.2007 07:31:47 von eastcoastguyz

On Nov 30, 8:14 am, taps128 wrote:
> eastcoastguyzwrote:
> > On Nov 30, 1:23 am, taps128 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