Running file_put_contents in parallel? Running file_put_contents in parallel? curl curl

Running file_put_contents in parallel?


Your bottleneck (most likely) is your curl requests, you can only write to a file after each request is done, there is no way (in a single script) to speed up that process.

I don't know how it all works but you can execute curl requests in parallel: http://php.net/manual/en/function.curl-multi-exec.php.

Maybe you can fetch the data (if memory is available to store it) and then as they complete fill in the data.


Just run more script. Each script will download some urls.

You can get more information about this pattern here: http://en.wikipedia.org/wiki/Thread_pool_pattern

The more script your run the more parallelism you get


I use on paralel requests guzzle pool ;) ( you can send x paralel request)

http://docs.guzzlephp.org/en/stable/quickstart.html