Re: $35 to the first person who can do this XML-parsing PHP script

From: Date: Thu, 08 Mar 2007 21:04:54 +0000
Subject: Re: $35 to the first person who can do this XML-parsing PHP script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-250126@lists.php.net to get a copy of this message
Rob Gould wrote: > I'll send $35 to someone via paypal who can create a PHP script that > will do the following: > > 1) Read XML data from an URL (www.librarytools.com/events/sampledata.txt) > 2) Loop through all XML results and print to the screen the "eventname" > and "eventnextoccurrencedate" (Just the date) values <table> <tr><th>Name</th><th>Date</th></tr> <?php $xml = simplexml_load_file('http://librarytools.com/events/sampledata.txt'); foreach ($xml->source->result as $f) { $name = '?'; $date = '?'; foreach ($f as $event) { if ($event['n'] == 'eventname') { $name = $event; } elseif ($event['n'] == 'eventnextoccurrencedate') { $date = date('D, M d Y H:i:s', strtotime($event)); } } echo " <tr><td>{$name}</td><td>{$date}</td></tr>\n"; } ?> </table> Gotta love SimpleXML. :-) -- Chris Shiflett http://shiflett.org/

« previous php.general (#250126) next »