simplexml_load_file() error checking

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psm9640
Forum Newbie
Posts: 14
Joined: Tue May 29, 2007 3:59 pm

simplexml_load_file() error checking

Post 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
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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)
Post Reply