is there any better way to use Youtube PHP API
You can use curl_multi_*
to do requests for different users in parallel. It won't speed up the process for every single user, but since you can do 10-30 or more requests in parallel, it will speed up the whole deal.
The only complication is that you will need separate cookie file for every request. Here's sample code to get your started:
$chs = array();$cmh = curl_multi_init();for ($t = 0; $t < $tc; $t++){ $chs[$t] = curl_init(); // set $chs[$t] options curl_multi_add_handle($cmh, $chs[$t]);}$running=null;do { curl_multi_exec($cmh, $running);} while ($running > 0);for ($t = 0; $t < $tc; $t++){ $contents[$t] = curl_multi_getcontent($chs[$t]); // work with $contencts[$t] curl_multi_remove_handle($cmh, $chs[$t]); curl_close($chs[$t]);}curl_multi_close($cmh);