PHP Classes

How to parse a remote XML file

Recommend this page to a friend!

      Generic XML parser class  >  All threads  >  How to parse a remote XML file  >  (Un) Subscribe thread alerts  
Subject:How to parse a remote XML file
Summary:How to parse a remote XML file having a URL
Messages:6
Author:Fahd Murtaza
Date:2009-04-20 15:23:56
Update:2010-11-23 12:11:06
 

  1. How to parse a remote XML file   Reply   Report abuse  
Picture of Fahd Murtaza Fahd Murtaza - 2009-04-20 15:23:56
n my test_xml_parser.php file,

line 50 to 55 have follwing code

$file_name="http://api.tweetmeme.com/popular.xml?media=business";
$error=XMLParseFile($parser,$file_name,1,$file_name.".cache");
if(strcmp($error,""))
echo "<H2><CENTER>Parser error: $error</CENTER></H2>\n";
else
{

So I am trying to open this remote XML.

Reagards,
Fahd Muratza

  2. Re: How to parse a remote XML file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-04-20 20:29:00 - In reply to message 1 from Fahd Murtaza
That should work.

  3. Re: How to parse a remote XML file   Reply   Report abuse  
Picture of John Prybylski John Prybylski - 2009-06-06 07:55:29 - In reply to message 2 from Manuel Lemos
You do realize that file_exists doesn't work with remote files, right? That's where the problem is coming from.

  4. Re: How to parse a remote XML file   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-06-06 08:36:00 - In reply to message 3 from John Prybylski
You are right. This class was created before remote file access was possible and I have not used it for purpose.

A fixed version with file existence checks was uploaded now. Thank you for reporting.

  5. Re: How to parse a remote XML file   Reply   Report abuse  
Picture of John Prybylski John Prybylski - 2009-06-06 13:32:30 - In reply to message 4 from Manuel Lemos
Great; thanks.

  6. Re: How to parse a remote XML file   Reply   Report abuse  
Picture of Zamaan Zamaan - 2010-11-23 12:11:06 - In reply to message 5 from John Prybylski
Thanks for ponting out the error. i also get same. i should try the updated version now!