Parallel HTTP requests in PHP using PECL HTTP classes [Answer: HttpRequestPool class]

前端 未结 6 2209
生来不讨喜
生来不讨喜 2020-12-14 22:57

The HttpRequestPool class provides a solution. Many thanks to those who pointed this out.

A brief tutorial can be found at: http://www.phptutorial.i

6条回答
  •  温柔的废话
    2020-12-15 00:01

    You could use pcntl_fork() to create a separate process for each request, then wait for them to end:

    http://www.php.net/manual/en/function.pcntl-fork.php

    Is there any reason you don't want to use cURL? The curl_multi_* functions would allow for multiple requests at the same time.

提交回复
热议问题