<?php set_time_limit(0); class Vekil { var $sayfa; var $liste; function cagir() { $this->sayfa = file_get_contents("http://www.proxy4free.com/list/webproxy1.html"); } function ayristir() { preg_match("/<table class=\"table table-striped proxy-list\">(.*?)<\/table>/si", $this->sayfa,$cikti); preg_match_all("/<tr>(.*?)<\/tr>/si",$cikti[1],$sonuc); foreach($sonuc[1] as $value){ preg_match("/<a class=\"info\" href=\"http:\/\/iplocation.com\/(.*?)\"><\/a>/si",$value,$ip); if(isset($ip[1])){ if(strstr($ip[1],"?ip=")){ $this->liste[]=str_replace("?ip=","",$ip[1]); } } } } function rastgele() { $say = count($this->liste)-1; $rastgele = rand(0, $say); return $this->liste[$rastgele]; } } $proxy = new Vekil(); $proxy->cagir(); $proxy->ayristir(); echo $proxy->rastgele(); ?>
Çıktısı
185.14.31.78