C
C
chesar2014-11-27 14:31:37
PHP
chesar, 2014-11-27 14:31:37

Emulating multithreading in php?

Please advise a library for asynchrony in php.
There is a parser and something like this:

$classes = []; // Тут массив классов-парсеров
foreach ($classes as $class) {
 $parser = new $class;
 $news = new News();
 $news->title = $parser->getTitle();
 $news->url = $parser->getUrl();
 $news->save();
}

There are already quite a lot of parsers, and some of them work for a long time. Advise a library that can create and run the next parser without waiting for the previous one to finish.
It is also important that the parsers are independent of each other, and that a fatal error call in one of the classes does not kill the rest.
Server: debian7, nginx, php5.6

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2014-11-27
@chesar

pcntl_fork

D
dmitriy, 2014-11-27
@dmitriylanets

what prevents in the cycle to pull the curl page passing it the name of the class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question