|
Posted by "Richard Lynch" on 12/30/05 21:29
On Thu, December 29, 2005 12:40 am, benc11@gmail.com wrote:
> Is there any easy php script to run to view an xml file such as new
> headlines like so: http://news.google.com/?output=rss or can anyone
> point
> me in the right direction for good online tutorials or books.
If you mean to just READ the XML, do this:
<?php
$xml = file_get_contents("http://news.google.com/?output=rss") or
die("Unable to read Google RSS at this time. Please try again
later.");
?>
If you need to get just the headlines, you could do:
<?php
preg_match_all("/<title>([^<]*)<\\/title>/sU", $xml, $headlines);
var_dump($headlines[1]);
?>
You could do similar work to get any of the content you wanted from
the XML.
Or you could use Google to search for "PHP RSS parser" and find
innumerable solutions.
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|