|
Posted by NC on 02/25/06 02:34
Evil Bert wrote:
>
> I'm trying to write a PHP function that will go out to several sites
> to grab data using the CURL function. The results are then reformatted
> and displayed to the visitor.
>
> The problem is that I need to go out to 5 or more sites and each one
> takes approximately 10 to 30 seconds. So the problem I am faced with
> is, this is way too long (2+mins) forthe website visitor to wait. I'm
> not sure if PHP supports anytype of threads or any other way I could
> the task faster.
Are you sure you want this to be done for every visitor in real time?
A much faster approach would be:
1. Every hour, get the files in question, reformat them and store
the result for future use. Schedule this with cron and use the
command-line interpreter.
2. When the visitor requests the page, serve the data prepared
in step 1.
Cheers,
NC
Navigation:
[Reply to this message]
|