473,509 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Nov 29 '07 #1
8 1875
On Nov 29, 7:14 pm, eastcoastguyz <eastcoastg...@hotmail.comwrote:
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
Nov 29 '07 #2
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.
Nov 30 '07 #3
On Nov 29, 3:39 pm, Kailash Nadh <kailash.n...@gmail.comwrote:
On Nov 29, 7:14 pm,eastcoastguyz<eastcoastg...@hotmail.comwrote:
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:".

Nov 30 '07 #4
On Nov 30, 1:23 am, taps128 <nstje...@gmail.comwrote:
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

Nov 30 '07 #5
On Fri, 30 Nov 2007 08:59:50 +0100, eastcoastguyz
<ea***********@hotmail.comwrote:
On Nov 30, 1:23 am, taps128 <nstje...@gmail.comwrote:
>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
Nov 30 '07 #6
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/1...tunes-sharing/
Nov 30 '07 #7
eastcoastguyz wrote:
On Nov 30, 1:23 am, taps128 <nstje...@gmail.comwrote:
>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.
Nov 30 '07 #8
On Nov 30, 8:14 am, taps128 <nstje...@gmail.comwrote:
eastcoastguyzwrote:
On Nov 30, 1:23 am, taps128 <nstje...@gmail.comwrote:
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

Dec 6 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
5641
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
11
2125
by: David Morgenthaler | last post by:
How does one overide the iterator implied by the construct "for line in file:"? For example, suppose I have a file containing row,col pairs on each line, and I wish to write a subclass of file...
9
5792
by: Peter Hansen | last post by:
The term "mock filesystem" refers to code allowing unit or acceptance tests to create, read and write, and manipulate in other ways "virtual" files, without any actual disk access. Everything is...
2
5324
by: Gustaf Liljegren | last post by:
I'm using xml.sax.parseString to read an XML file. The XML file contains a few words in Russian, and is encoded in UTF-8 using C#. In the example below, MyParser() is my SAX ContentHandler class....
6
1993
by: John Baker | last post by:
Hi: Does "On Open" code execute before or after related data is loaded? I want to test before the form appears on the screen to see if there is any data in the queryresult, and if there is not...
0
2326
by: Trevor Andrew | last post by:
Hi There, I have posted something previously regarding this issue, but I think I have some more concise questions to ask, and would like to get further feedback on this issue. Firstly the...
3
1445
by: taurin423 | last post by:
I am working on integrating RSS reading into my ASP.NET web application. So far I have it working just fine with showing the full feed, but I'm not sure how to let it handle which items have been...
8
2325
by: Greg C. | last post by:
I tried tackling this problem about 6 months ago, but after going almost completely insane I gave up, since my news feed seemed to display just fine anyways. However, in an effort to have my feeds...
3
4494
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.