Answer the question
In order to leave comments, you need to log in
How to properly implement curl_multi?
There is a code:
//code removed
The script executes the account.setOnline method for each token from the database until they run out. Because there are a lot of tokens in the database (about 2k), then the script takes a long time and eventually crashes, and the method will not be executed for the remaining users. I solve this problem in such a way that I create several files and separate the database by 500 users. It turns out that I hang 5-6 files on cron that process their tokens. BUT this is not comme il faut ... I was advised to use curl_multi. I rummaged through Google and found this code:
//the code is deleted
But how can I make it so that, for example, the first 10 tokens are taken from the database and formed into an array, like:
//the code is deleted
then these links are executed and again until the tokens run out in the database . I can't figure out how to do it.
Answer the question
In order to leave comments, you need to log in
I personally use: https://github.com/bizonix/MultiCurl (PHP wrapper).
The addUrl() method is called in the loop, which adds addresses to it, after which wait() is called, which downloads in a multi-threaded manner and exits from which will be performed when all addresses have not been loaded.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question