Created
September 23, 2015 14:27
-
-
Save random-robbie/118c08d72a5fdbc4b339 to your computer and use it in GitHub Desktop.
Parse Proxy Auto Conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$list = file_get_contents("http://www.tellypass.com/pac/annie-2315"); | |
function scrape_between($data, $start, $end){ | |
$data = stristr($data, $start); // Stripping all data from before $start | |
$data = substr($data, strlen($start)); // Stripping $start | |
$stop = stripos($data, $end); // Getting the position of the $end of the data to scrape | |
$data = substr($data, 0, $stop); // Stripping all data from after and including the $end of the data to scrape | |
return $data; // Returning the scraped data from the function | |
} | |
$new = (explode(':80";',$list)); | |
foreach ($new as $newhost) | |
{ | |
$new = scrape_between($newhost, 'host=="', '")'); | |
echo 'zone "'.$new.'" { | |
type master; | |
file "/data/db.override"; | |
};'; | |
echo "\r\n"; | |
echo "\r\n"; | |
echo "\r\n"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment