On 5/31/06, Merlin <ngroups@xxxxxxxxxxx> wrote:
Hi there, I am reading a remote plain text file from another server via the file command: $str = file ("http:/xxxxx"); This is a feed so there is no other way then reading it remote. Now this reading takes up between 0.5 and 1.0 s which is far to slow. The whole other process on the site takes only 0.1 s and I would like to keep it inside this area of 0.1 - 0.2 s Is there a faster way to read a remote txt file than with file() ? If not, is there a way in php to process this in the background and continue to display the page without the results of the file? Thank you in advance, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
It's said on the manual that file_get_contents() is to be used if you want to read a text file. from the manual : "file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance." The loading speed may be also affected by the time your server needs to access the remote server. If the information is not updated really fast, you may create a cronjob to run every N minutes, and fetch that file on your server, than make your site access the local version of the file, that will effectively remove the network lag... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php