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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux