Page 1 of 1

simplexml_load_file() error checking

Posted: Thu Dec 27, 2007 12:55 pm
by psm9640
Hey folks,

I need some help on checking if data is loading from an XML file in this script. I don't need to check if it's well-formatted XML, I just need to know there is something there. I've been using a really simple podcast XML for the test:

Code: Select all

$xml = simplexml_load_file('http://grandriversvariety.com/podcast.xml');

if ($xml) { echo 'XML loaded successfully'; }
else { echo 'Unable to load XML'; }
All I get back here is "Unable to load XML". Any help would be great. Thanks.

I'm running PHP 5.2.0 on my mac under MAMP.

-PM

Posted: Thu Dec 27, 2007 6:18 pm
by Ambush Commander
Make sure remote URI inclusions are being allowed for your PHP. Also, try retrieving the webpage with file_get_contents()

(also, make sure your Mac is blocking outbound connections by PHP)