Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Function] Test HTTP/Socks 4/Socks 5 Proxy
#1
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($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_CONNECTTIMEOUT10);
curl_setopt($chCURLOPT_TIMEOUT10);
curl_setopt($chCURLOPT_PROXY$ip ":" $port);
if(
$type == "SOCKS 4"curl_setopt($chCURLOPT_PROXYTYPECURLPROXY_SOCKS4);
else if(
$type == "SOCKS 5"curl_setopt($chCURLOPT_PROXYTYPECURLPROXY_SOCKS5);
$html curl_exec($ch);
$info curl_getinfo($ch);
if(
curl_errno($ch) || $html == "") {
return 
FALSE;
}else{
return 
TRUE;
}
curl_close($ch);

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Noob's doubt on echo function in php mandi 5 1,738 12-09-2010, 06:00 AM
Last Post: Orgy
  [Function] Force download of a file OX!DE 1 932 02-25-2010, 07:28 PM
Last Post: h1r0n
  [Function] XOR Encryption/Decryption with a Key OX!DE 0 2,244 02-21-2010, 07:14 PM
Last Post: OX!DE
  Youtube plugin not working (proxy) Extasey 0 1,548 10-23-2009, 02:32 AM
Last Post: Extasey
  Email PHP function and connecting it to a form Tasemu 3 2,384 10-09-2009, 05:22 AM
Last Post: Tasemu

Forum Jump:


Users browsing this thread: 1 Guest(s)