PHP Classes

Parsing a URL

Recommend this page to a friend!

      Clean XML To Array  >  All threads  >  Parsing a URL  >  (Un) Subscribe thread alerts  
Subject:Parsing a URL
Summary:A small change needs to be made in order to parse a XML file URL
Messages:2
Author:Christopher Duarte
Date:2007-08-16 20:46:30
Update:2007-08-24 15:53:26
 

  1. Parsing a URL   Reply   Report abuse  
Picture of Christopher Duarte Christopher Duarte - 2007-08-16 20:46:30

117c117,119
< $data = fread($fop, filesize($src));
---
> while (!feof($fop)) {
> $data .= fread($fop, 1024);
> }

Changing this one line of text, I was able to parse an XML file located at a URL address. Otherwise the filesize() function would error stating that it couldn't stat the file.

  2. Re: Parsing a URL   Reply   Report abuse  
Picture of Ivan Enderlin Ivan Enderlin - 2007-08-24 15:53:26 - In reply to message 1 from Christopher Duarte
Hey there :)

I'm back for holidays, sorry for this late response.

You're right, it's a best way to use fread(). I have always used NULL options, because I read files with my own File package.
I edit it right now ;-)

Thanks.