Guest User

Untitled

a guest
Dec 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. require_once('email_checker.class.php');
  3.  
  4. class Task extends Threaded
  5. {
  6. private $value;
  7.  
  8. public function __construct(int $i)
  9. {
  10. $this->value = $i;
  11. }
  12. public function run()
  13. {
  14. $file_lines = file('mail.txt');
  15. $emailChecker = new emailChecker; // Make a new instance
  16.  
  17.  
  18. foreach ($file_lines as $line) {
  19.  
  20. $response = $emailChecker->check($line);
  21. foreach($response as $result) {
  22. echo $result['query'].'-'.$result['success']."n";
  23. }
  24. }
  25.  
  26.  
  27. }
  28. }
  29. $file_lines = file('mail.txt');
  30. # Create a pool of 4 threads
  31. $pool = new Pool(4);
  32. for ($i = 0; $i < 15000; ++$i)
  33. {
  34. $pool->submit(new Task($i));
  35. }
  36.  
  37. while ($pool->collect());
  38.  
  39. $pool->shutdown();
Add Comment
Please, Sign In to add comment