简体   繁体   中英

PHP cURL multithreading without curl_multi, how to?

I know it's most likely a very dumb question to ask, and I've been using curl_multi and classes such as https://github.com/petewarden/ParallelCurl/ for multithreading.

But recently I came across this building a web proxy, an open-source PHP web proxy framework called glype .

it seems to me all resources are fetched by cURL, and there's no curl_multi in its source code whatsoever, the code contains only curl_init and curl_exec.

That said, img's (and probably other src too) load concurrently, I briefly went through the code, but failed to find a clue how it works this way.

Anyone have tried multithreading cURL without using curl_multi? (PHP pthread not included)

cURL Multi has nothing whatever to do with multi-threading, or parallelism.

cURL Multi is a set of functions within the cURL extension that use non-blocking I/O for asynchronous execution of requests.

To be clear, cURL Multi is not parallel, nor multi-threaded: It facilitates non-blocking asynchronous I/O.

Glype uses the processing model of the server serving the code: When your browser requests a page through Glype, the server is responsible for creating (or reusing) the process that executes Glype. In the same way, when the page requests resources like CSS or images from the server, it is the server that creates (or re-uses) a process, which in turn executes the PHP interpreter, which in turn executes Glype.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM