Skip to content

Instantly share code, notes, and snippets.

@oott123
Created April 30, 2013 11:29
Show Gist options
  • Save oott123/5488135 to your computer and use it in GitHub Desktop.
Save oott123/5488135 to your computer and use it in GitHub Desktop.
PHP代理检测
<?php
function isproxy(){
$ports = array(80, 88, 1075, 1080, 1180, 1182, 2282, 3128, 3332, 5490, 6588, 7033, 7441, 8000, 8080, 8085, 8090, 8095, 8100, 8105, 8110, 8888, 22788);
foreach ($ports as $port){
$sd = @fsockopen($_SERVER["REMOTE_ADDR"], $port, $errno, $errstr, 1);
if ($sd){
fclose($sd);
return true;
}
}
return false;
}
//用法:
//if(isproxy())die('请勿使用代理申请!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment