mobile=$mobile; } public function changeCurl() { if($this->login=="") $currentCooky=cookiesDirectory.uniqid().".txt"; else $currentCooky=cookiesDirectory.$this->login.".txt"; if(file_exists($currentCooky)) unlink($currentCooky); $this->close(); //$browser=random_user_agent_mobile($this->mobile); $browser=random_user_agent(); $referrer=get_random_referrer(); $this->curl=new cURL($currentCooky,$browser,"",$referrer); } public function postData($url,$data) { //------Stop if it's time to stop the process----*/ $valide=false; $noValide=0; if(!is_object($this->curl)) $this->changeCurl(); while((!$valide)&&($noValide<10)) { $this->curl->setUrl($url); $this->curl->setPost($data); $result=$this->curl->createCurl(); if($result["curl_error"]=="") $valide=true; else die(" ==> HTTP CODE:".$result["http_code"]."
Can't open the url ".$url."
".$result["curl_error"]); $noValide++; /*if($result["http_code"]==0) $this->add_debug_exit($this->processName." ==> HTTP CODE:".$result["http_code"]."
Can't open the url ".$url."
".$result["curl_error"],1);*/ } if($noValide>=10) die(" ==> HTTP CODE:".$result["http_code"]."
Can't open the url ".$url."
".$result["curl_error"]); $this->last_url=$result['last_url']; $this->header_curl=$result['header']; return $result["body"]; } public function getContent($url) { //------Stop if it's time to stop the process----*/ $valide=false; $noValide=0; if(!is_object($this->curl)) $this->changeCurl(); while((!$valide)&&($noValide<10)) { $this->curl->setUrl($url); $result=$this->curl->createCurl(); if($result["http_code"]==503) { $valide=true; break; } if($result["curl_error"]=="") $valide=true; else { return "error"; } $noValide++; /*if($result["http_code"]==0) $this->add_debug_exit($this->processName." ==> HTTP CODE:".$result["http_code"]."
Can't open the url ".$url."
".$result["curl_error"],1);*/ } if($noValide>=10) return "error"; $this->last_url=$result['last_url']; $this->header_curl=$result['header']; return $result["body"]; } function close() { if(is_object($this->curl)) { $this->curl->close(); if($this->curl->path_to_cookies!="") { if(file_exists($this->curl->path_to_cookies)) { unlink($this->curl->path_to_cookies); } } unset($this->curl); } } } ?>