Re: XML Reader

From: Date: Fri, 30 Dec 2005 19:29:39 +0000
Subject: Re: XML Reader
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228037@lists.php.net to get a copy of this message
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

« previous php.general (#228037) next »