SimpleDOM sortedXPath date sorting works on localhost but not on remote server.

Posted by Imminent on Stack Overflow See other posts from Stack Overflow or by Imminent
Published on 2010-03-30T11:29:36Z Indexed on 2010/03/30 11:33 UTC
Read the original article Hit count: 461

Filed under:
|
|

Here's what i'm trying to do:
1) Take a basic XML page (data.xml)
2) Load it with simpleDOM
3) Use simpleDOM sortedXPath to sort all XML items by their pubDate
4) Display sorted output

Here is the code I currently have. My code below outputs exactly what I need when run it on my localhost (XAMPP w/PHP 5.3) but on my remote server (which has at least PHP 5.0+) all is lost and a completely blank page is output. It will output the $xml array with print_r though. Here is my code:

<?php 

include('SimpleDOM.php');

$xml = simpledom_load_file('data.xml');
$dateformat = "D j M, g:ia";

/* print_r($xml); <-array will output on remote server if put here, but alas
                    nothing else beyond this point */

/*Output First 5 items sorted by pubDate*/
foreach($xml->channel->sortedXPath('item','pubDate', SORT_DESC) as $i => $item){
   if ($i > 4){
        break;
    }

    print "<p>This Weeks Deal:<strong> ".$item->title."</strong></p>";
    print  $item->description;
    print "<p>Date Posted:<strong> ".date($dateformat, strtotime($item->pubDate))."</strong></p>";

}

?>

Like I said, this code seems to work great on my localhost... but not being able to run it on my remote server is making me crazy. Any ideas ?? Any help will be far beyond appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about simplexml