Dicas

Notícias

Canal Solução

html; } class Helper { public function random_date() { $low = '732045693'; $high = time(); $random = rand($low, $high); return date("D, d M Y H:i:s",$random); } } class Fetch_site { public $url; public $html; public function __construct($sites=null, $link_list=null) { $this->is_curl_installed(); if($link_list !== null) { $this->choose_site($link_list); } $this->load_site($this->url); } public function choose_site($file=null) { $file = explode("\n", $file); $key = rand(0, (count($file)-1)); $this->url = trim($file[$key]); } public function load_site($url) { $useragent = array('Link-Soft'); $rand = array_rand($useragent); $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_HEADER => 0, CURLOPT_USERAGENT => $useragent[$rand], CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_ENCODING => "", CURLOPT_AUTOREFERER => 1, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_TIMEOUT => 30, CURLOPT_MAXREDIRS => 5, ); curl_setopt_array($ch,$options); $result = curl_exec($ch); if(!$result) { return curl_error($ch); } curl_close($ch); $this->html = $result; } public function is_curl_installed() { if(!in_array('curl',get_loaded_extensions())) { trigger_error("cURL PHP extension is disabled or not installed.",E_USER_ERROR); } } } unset($ņ); ?>