0

I have copied/pasted my current proxy detection system below, although it takes forever to load on the webpage. Please could someone advise me on how I can improve the load speed. Thanks

function proxy_detected()
{
  if (
     $_SERVER['HTTP_X_FORWARDED_FOR']
  || $_SERVER['HTTP_X_FORWARDED']
  || $_SERVER['HTTP_FORWARDED_FOR']
  || $_SERVER['HTTP_CLIENT_IP']
  || $_SERVER['HTTP_VIA']
  || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
  || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
  {
      return true;
  } else {
      return false;
  }
}

echo ( proxy_detected() ) ? "Proxy detected" : "No proxy detected";
  • You will never get this to do exactly what it's doing now any more quickly. You're opening a connection to the server and even allow this to take up to 30 seconds...there is no way in hell that this could be fast. – Till Helge Jun 14 '14 at 10:26
  • possible duplicate of [Detect clients with Proxy Servers via PHP](http://stackoverflow.com/questions/858357/detect-clients-with-proxy-servers-via-php) – Till Helge Jun 14 '14 at 10:27

0 Answers0