Advertisement
Ostap34PHP

Untitled

Jul 15th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1.     /**
  2.      * Get current proxy
  3.      */
  4.     public static function getProxy()
  5.     {
  6.         $current_proxy_line = file_get_contents(__DIR__ . '/../config/current_proxy_line.txt');
  7.  
  8.         $lines = file(__DIR__ . '/../config/proxy_list.txt', FILE_IGNORE_NEW_LINES);
  9.  
  10.         $proxy = $lines[$current_proxy_line];
  11.  
  12.         if (empty($proxy)) {
  13.             $current_proxy_line = 0;
  14.             $proxy = $lines[$current_proxy_line];
  15.         }else{
  16.             $current_proxy_line++;
  17.         }
  18.         file_put_contents(__DIR__ . '/../config/current_proxy_line.txt', $current_proxy_line);
  19.  
  20.         return $proxy;
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement