Skip to content

Instantly share code, notes, and snippets.

@qsun
Created January 28, 2012 23:37
Show Gist options
  • Save qsun/1696289 to your computer and use it in GitHub Desktop.
Save qsun/1696289 to your computer and use it in GitHub Desktop.
Convert squid proxy list to switch proxy list
<html>
<head>
<title>Squidproxies List to SwitchProxy</title>
</head>
<body>
<h1>An easy way to switch squidproxies to SwitchProxy</h1>
<form method="post">
<label>Please input your proxy list</label><textarea name="proxies" cols="80" rows="10"></textarea>
<br />
<input type="submit" />
</form>
<?php
if ($_POST['proxies']) {
$proxies = explode("\n", $_POST['proxies']);
$count = 0;
$switch_proxy = '';
foreach ($proxies as $proxy) {
$p = strip_tags(trim($proxy));
if ($p) {
$switch_proxy = $switch_proxy . "\n[squid{$count}\nall={$p}\nclear=cache\n]\n";
$count++;
}
}
?>
<h2>Result</h2>
<textarea rows="80" cols="80">
<?php echo $switch_proxy; ?>
</textarea>
<hr />
<?php
}
?>
<div class="footer">
<a href="http://www.squidproxies.com/billing/aff.php?aff=347">Squid Proxies</a>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment