Jump to content
michee

proxy checker in php

Recommended Posts

mai jos e un proxy checker in php. facut de mine, pornit de la ceva gasit pe net.

Verificarile sa fac pe pagina PROXY checker results, puteti folosi si alta, cu conditia sa setati un sir de caractere care trebuie sa existe in pagina aia.

Se verifica si variabilele:

'HTTP_FORWARDED','HTTP_X_FORWARDED_FOR','HTTP_CLIENT_IP',

'HTTP_VIA','HTTP_XROXY_CONNECTION','HTTP_PROXY_CONNECTION'


<?php


require "string_utils.php";

class phpanon {

public $anons = array();
public $opts = array("user_agent" => "", "url_referer" => "", "url" => "http://checker.samair.ru/", "needle" => "Resume");

function __construct($opts =array()) {

if(isset($opts["anon"]) && count($opts["anon"]) > 0) {
$this->set_proxy($opts["anon"]);
}

if(isset($opts["user_agent"]) && $opts["user_agent"] != "") {
$this->opts["user_agent"] = $opts["user_agent"];
}

if(isset($opts["url_referer"]) && $opts["url_referer"] != "") {
$this->opts["url_referer"] = $opts["url_referer"];
}

}

function parse($html){

$arr = array('HTTP_FORWARDED','HTTP_X_FORWARDED_FOR','HTTP_CLIENT_IP',
'HTTP_VIA','HTTP_XROXY_CONNECTION','HTTP_PROXY_CONNECTION');

$elite = true;
foreach($arr as $k=>$a){

if($k==3) // doar la al 3 element am un spatiu in plus la parsare
advance($html,'<b>'.$a.': </b>');
else
advance($html,'<b>'.$a.':</b>');


if($k == 2){
fetch($html,'<h2>',$$a);
}
else{
fetch($html,'<br />',$$a);
}

$$a = trim($$a);

if($$a != '(none)')
$elite = false;

//echo " ". strtolower($a). ' === ' .$$a. "<br>\n";
}

$this->elite = $elite;

if($elite)
echo "elite proxy <br>\n";
else
echo "non elite proxy <br>\n";

}

function check() {

$anon = $this->anon;

if($anon["ip"] != "" && $anon["port"] != "" && $anon["type"]) {

echo "Checking ".$anon["ip"].":".$anon["port"]." [ type ".$anon["type"]." ] ... <br>\n";
$ch = curl_init($this->opts["url"]);

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_FOLLOWLOCATION, 1);

if($this->opts["user_agent"] != "") {
curl_setopt($ch, CURLOPT_USERAGENT, $this->opts["user_agent"]);
}
if($this->opts["url_referer"] != "") {
curl_setopt($ch, CURLOPT_REFERER, $this->opts["url_referer"]);
}

curl_setopt($ch, CURLOPT_PROXY, $anon["ip"].":".$anon["port"]);

if($anon["type"] == "socks4"){
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
}
else{
if($anon["type"] == "socks5") {
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
}
}

$html = curl_exec($ch);
if(curl_errno($ch) || $html == "" || strpos($html, $this->opts["needle"]) === FALSE) {
$anon["status"] = 0;
echo "not working<br><br>\n";
} else {

$anon["status"] = 1;
$this->parse($html);
echo "working<br><br>\n";
}
curl_close($ch);
unset($ch);
}
}

public function set_proxy($proxy){
$this->anon = $proxy;
}
}



$anons = array(
array("ip" => $ip , "port" => $port_server, "type" => "socks5"),

);
// type poate fi socks4, sock5 sau '' si atunci e http proxy

$pa = new phpanon();
foreach($anons as $a){
$pa->set_proxy($a);
$pa->check();
}


?>

string_utils.php contine:


<?

function fetch($string,$where,&$in){


$pos=strpos($string,$where);
$in=substr($string,0,$pos);

if($pos !== false)
return true;
else
return false;
}



function advance(&$string,$where){


$pos = strpos($string,$where);
$string=substr($string,$pos+strlen($where),strlen($string));

if($pos !== false)
return true;
else
return false;

}

?>

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...