Reply to Re: [PHP] XML Reader

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на 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

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