Page 1 of 1

Accessing XML documents in the server from a PHP script

Posted: Tue Jul 11, 2006 12:24 pm
by rsouthon
Hey,

I'm kinda new to PHP so I'm not even sure it's the right tool for the job but here goes:

I have a few reference documents that are used throughout my site. They are fairly large XML & XSLT documents that need to be used quite often by multiple php and javascript functions. How do I store these documents in the server memory so that they don't need to be reloaded each time a function uses them?

The way I'm doing it now is sending a GET HTTP header to give me the file and then using DOM to parse it and get my info - kindof AJAX-like. But the GET is slow and I want to avoid it.

Any ideas? Am i going about this the wrong way? Can PHP solve my problems?

Thanks so much!

Posted: Tue Jul 11, 2006 12:38 pm
by RobertGonzalez
PHP can handle XML parsing fairly effectively and efficiently if done right. There are some native XML functions to PHP, but most fokls use them to make their own XML readers. In fact, I have just taken a script I found on a tutorial at Sitepoint and used that as a basis for a multi-input XML/RSS reader. So yeah, PHP can do it and it can do it well if done right.

Posted: Tue Jul 11, 2006 12:48 pm
by jamiel
How do I store these documents in the server memory so that they don't need to be reloaded each time a function uses them?
Look at memcache and the PHP Memcache functions : http://php.net/memcache