L
L
lohmag2016-05-22 02:24:54
PHP
lohmag, 2016-05-22 02:24:54

Multithreading in JSON PHP?

I made a handler that accesses a specific http link and receives a json response. It works very slowly, how to make it multi-threaded so that it runs a bunch of requests at the same time? Or is php single-threaded and you can't implement it that way?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2016-05-22
Protko @Fesor

Or is php single-threaded and you can't implement it that way?

In addition to "threads", there are also non-blocking calls. This is exactly what you need.
I recommend this library: https://github.com/mpyw/co or even better https://github.com/recoilphp/recoil

B
Barnie Savington, 2016-05-22
@iwex

What does slow mean, find out the reason for this behavior, maybe the server where you send the request is slowly processing it.
Multithreading doesn't exist in PHP, but it can be "emulated" - 1 , 2 and so on, whatever Google says.

D
DarkMatter, 2016-06-08
@darkmatter

Multithreading in PHP
https://habrahabr.ru/post/300952/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question