dont know exact answer...but maybe i can help you or point you to some good way
if i understand...you want to parse some xml from web -> mean,
download xml and parse it ... so, maybe u should try to "avoid" using
cakephp defined functions (create some component to download and parse
zml - witch you will manage ...)

but i think, using so much big xml file (assuming from load time) is
not very good for your security (simple dos attack)... i should modify
web to load it from ftp - web directory and i should manualy copy xml
there... (loading of xml in php is not very time consuming - if xml is
very large file, php compil. doesnt take time to check validity just
use pointers - so far i know)

2010/3/10 cartosys <[email protected]>:
> code:
>
>        $link = 'http://some.xml.feed.xml';
>        $parsed_xml = new XML($link);
>        $parsed_xml = Set::reverse($parsed_xml);
>
> The XML feed at hand is one that took over a minute to load via
> browser.  cakephp's XML returned an empty array after Set::reverse,
> and always after ~30 seconds (timed with a timer).
>
> I looked into the deeper funcionality and found the trail to the
> problem:
>
> wWhen "new Xml" is defined, xml.php calls http-socket.php's load
> function which then calls socket.php's read function:
>
> The function, which starts on line 217 of socket.php, contains the
> line:
>
>            $buffer = fread($this->connection, $length);
>
> Which is where the parser time's out after 30 seconds.  This can't be
> fixed by raising any php.ini timout values which I set to 10 minutes.
>
> max_execution_time = 600
> max_input_time = 600
>
> So my only solution now is to break the rules and modify cake/lib/
> socket.php  with the following line of code just above the above
> mentioned fread line which works:
>
> stream_set_timeout ($this->connection, 600);
>
> The final read function looks like this:
>    function read($length = 1024) {
>        if (!$this->connected) {
>            if (!$this->connect()) {
>                return false;
>            }
>        }
>        if (!feof($this->connection)) {
>            stream_set_timeout ($this->connection, 600);  //added this
>            $buffer = fread($this->connection, $length);
>            $info = stream_get_meta_data($this->connection);
>            if ($info['timed_out']) {
>                $this->setLastError(E_WARNING, __('Connection timed
> out', true));
>                return false;
>            }
>            return $buffer;
>        } else {
>            return false;
>        }
>    }
>
> If anybody knows of a better workaround (like setting
> stream_set_timeout elsewhere in cake or php.ini), that would rock.
>
>
>
> xml parser cakephp ubuntu 9.10
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to