SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SimpleXML errors

    Hi everyone,

    Having a few problems parsing an XML file using SimpleXML.

    PHP Code:
    $xmlstr simplexml_load_file('http://feeds.feedburner.com/BloggerFCO'); 
    The above code results in the following errors:
    Code:
    Warning: simplexml_load_file() [function.simplexml-load-file]: http://feeds.feedburner.com/BloggerFCO:1: parser error : Document is empty in /home/civicsur/public_html/local/task/test/feedtest.php on line 3
    
    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/civicsur/public_html/local/task/test/feedtest.php on line 3
    
    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/civicsur/public_html/local/task/test/feedtest.php on line 3
    
    Warning: simplexml_load_file() [function.simplexml-load-file]: http://feeds.feedburner.com/BloggerFCO:1: parser error : Start tag expected, '<' not found in /home/civicsur/public_html/local/task/test/feedtest.php on line 3
    
    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/civicsur/public_html/local/task/test/feedtest.php on line 3
    
    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/civicsur/public_html/local/task/test/feedtest.php on line 3
    Strangely, when I use the following code, it works fine:

    PHP Code:
    $xml file_get_contents('http://feeds.feedburner.com/BloggerFCO');
    $xmlstr simplexml_load_string($xml); 
    Anyone know what's going wrong here?

    Edit: Should have added that the first code snippet I posted works fine for other XML files, just not the one in question

    Thanks!

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2009
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Feeds are always funky. I would use SimplePie or MagPie to parse them rather than SimpleXML.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •