Skip to content

Instantly share code, notes, and snippets.

@RieqyNS13
Last active July 21, 2016 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RieqyNS13/fa78691f9edcd6906287 to your computer and use it in GitHub Desktop.
Save RieqyNS13/fa78691f9edcd6906287 to your computer and use it in GitHub Desktop.
<?php
/*
Filename: Hidemyass Proxy Grabber
Coder: RieqyNS13
*/
class rieqyns13{
private $negara;
private $type;
private $anon;
private $speed;
private $connect_time;
public $filter_speed=array(1,0);
public $filter_connection_time=array(1,0);
public $jumlah=50;
public $no_country=array();
function __construct($x){
if(!function_exists("curl_init"))exit("curl not found :p");
$this->speed=$x[0];
$this->connect_time=$x[1];
$this->negara=$x[2];
$this->type=$x[3];
$this->anon=$x[4];
}
function curl($url,$data=null){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($data != null){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:33.0) Gecko/20100101 Firefox/33.0");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_VERBOSE, true);
//curl_setopt($ch, CURLOPT_TIMEOUT, 13);
$exec = curl_exec($ch);
curl_close($ch);
return $exec;
}
function cekIP($arr,$pola){
$pola=preg_replace("|\s+|","",$pola);
if(preg_match("{display\:inline}si", $pola))return true;
else if(preg_match("{class}", $pola)){
$pecah=explode("=",$pola);
$class=str_replace("\"","",trim(end($pecah)));
if(isset($arr[$class]) && $arr[$class]!="none")return true;
else if(!isset($arr[$class]))return true;
}
}
function Gay(){
$total=0;
$next=2;
$data=$this->curl("http://proxylist.hidemyass.com/");
//$data=file_get_contents("proxyass.html");
//$data=file_get_contents("proxy2.html");
do{
preg_match("#\<tbody\>(.*?)\</tbody\>#is", $data, $m);
$doc=new DOMDocument;
$doc->loadHTML($m[1]);
$tr=$doc->getElementsByTagName("tr");
$keyTr=0;
while($keyTr<$tr->length && $total<$this->jumlah){
//foreach($tr as $key=>$trCok){
$lewati=false;
$trCok=$tr->item($keyTr);
$anak=$trCok->childNodes;
$html='';
foreach($anak as $mbuh){
$html.=$trCok->ownerDocument->saveHTML($mbuh);
}
preg_match("{\<span\>\s+\<style\>(.*?)\</style\>}s", $html, $m);
$css=explode("\n",trim($m[1]));
foreach($css as $mbuh){
$gay=explode("{",$mbuh);
$keyCuk=str_replace(".","",$gay[0]);
if(preg_match("/display:none/si", $mbuh))$style[$keyCuk]="none";
else if(preg_match("/display:inline/si", $mbuh))$style[$keyCuk]="inline";
}
$homo=preg_split("{[<>]}si", $html);
unset($proxy);
unset($jancok);
foreach($homo as $key=>$ikkeh){
if(preg_match("{class=\"country\" rel=\"}",$ikkeh)){
//echo $ikkeh."\n".$key;die;
$kode_negara=substr(trim($ikkeh),-3,2);
//echo $kode_negara."\n";
if(in_array($kode_negara,$this->no_country)){
$lewati=true;
$keyTr++;
//echo "asu{$keyTr}";
break;
}
}else if(is_numeric(trim($ikkeh))){
if($this->cekIP($style,$homo[$key-1]) || preg_match("{^/}is", $homo[$key-1]))$proxy[]=trim($ikkeh);
if($homo[$key-1]=="td" && $homo[$key+1]=="/td")$port=trim($ikkeh);
//echo $homo[$key-1]."\n";
}else if($key<count($homo)-1 && $key>1){
if($homo[$key-1]=="td" && $homo[$key+1]=="/td")$type=$ikkeh;
if($homo[$key-1]=="td nowrap" && $homo[$key+1]=="/td")$anon=$ikkeh;
if(preg_match("{^img src}is",$homo[$key-1]) && preg_match("{^/}",$homo[$key+1]))$negara=$ikkeh;
if(preg_match("{div class\=\"indicator\"}is", $homo[$key])){
if(preg_match("{0, 173, 173}",$homo[$key]))$kode=0;
else if(preg_match("{255, 204, 0}",$homo[$key]))$kode=1;
else if(preg_match("{237, 28, 36}",$homo[$key]))$kode=2;
if(!isset($jancok["speed"])){
$jancok["speed"]=$kode;
}
else $jancok["connect_time"]=$kode;
}
}
}
if($lewati)continue;
$status1=null;$status2=null;
switch($jancok["speed"]){
case 0:$status1="Hight";break;
case 1:$status1="Medium";break;
case 2:$status1="Low";break;
default:$status1=null;break;
}
switch($jancok["connect_time"]){
case 0:$status2="Hight";break;
case 1:$status2="Medium";break;
case 2:$status2="Low";break;
default:$status2=null;break;
}
$mbut= preg_replace("{\.+}", ".",implode('.',$proxy).":".$port);
$mbut.=($this->speed)?" ".$status1:null;
$mbut.=($this->connect_time)?" ".$status2:null;
$mbut.=($this->negara)?" ".$negara:null;
$mbut.=($this->type)?" ".$type:null;
$mbut.=($this->anon)?" ".$anon:null;
$keyTr++;
if(in_array($jancok["speed"],$this->filter_speed) && in_array($jancok["connect_time"],$this->filter_connection_time)){
$jembuts[]=$mbut;
$total++;
//echo $total." ".$keyTr."\n";
}
}
if($total<$this->jumlah){
$data=$this->curl("http://proxylist.hidemyass.com/".$next."#listable");
$next++;
}
}while($total<$this->jumlah && $next<=5);
return $jembuts;
}
}
$x[0]=false; //tampil speed
$x[1]=false; //tampil connection time
$x[2]=false; //tampil negara
$x[3]=false; //tampil type proxy
$x[4]=false; //tampil Anon
$gay=new rieqyns13($x);
/*
0=low
1=medium
2=high
*/
$gay->jumlah=100;
$gay->filter_speed=array(0,1,2);
$gay->filter_connection_time=array(0,1,2);
$gay->no_country=array("cn");
foreach($gay->Gay() as $homo)echo $homo."\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment