Skip to content

Instantly share code, notes, and snippets.

@random-robbie
Created September 23, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save random-robbie/118c08d72a5fdbc4b339 to your computer and use it in GitHub Desktop.
Save random-robbie/118c08d72a5fdbc4b339 to your computer and use it in GitHub Desktop.
Parse Proxy Auto Conf
<?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