A quick function using cURL to identify if a certain proxy server is currently working/accepting connections, returns true if it is.
PHP Code:
<?php
// Live Demo: http://x32.bz/tools/proxychecker/
// Example Usage: checkproxy("222.124.223.42","3128","SOCKS 5");
function checkproxy($ip,$port,$type){
$ch = curl_init("127.0.0.1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_PROXY, $ip . ":" . $port);
if($type == "SOCKS 4") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
else if($type == "SOCKS 5") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
$html = curl_exec($ch);
$info = curl_getinfo($ch);
if(curl_errno($ch) || $html == "") {
return FALSE;
}else{
return TRUE;
}
curl_close($ch);
}