Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Get current proxy
- */
- public static function getProxy()
- {
- $last_line = file_get_contents(__DIR__ . '/../config/current_proxy_line.txt');
- $allow_next_line = false;
- $handle = fopen(__DIR__ . "/../config/proxy_list.txt", "r");
- $line_number = 0;
- //check any lines of file
- while (($line = fgets($handle))) {
- $line_number++;
- if (empty($line)) {
- $last_line = 0;
- }
- //bug fix with 0
- if ($last_line == 0) {
- $allow_next_line = true;
- }
- if ($allow_next_line) {
- return $line;
- file_put_contents(__DIR__ . '/../config/current_proxy_line.txt', $line_number);
- break;
- }
- //if line = current line from file
- if ($line_number == $last_line) {
- $allow_next_line = true;
- }
- }
- fclose($handle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement