Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
My attempt to write a tool for counting votes in Mafia.
class Parser{
public $url=null;
public $tag=null;
public $tag_class=null;
public function setURL($text){
$this->url=$text;
}
public function setSearchTag($text){
$this->tag=$text;
}
public function setTagClass($text){
if(!empty($text)){
$this->tag_class=' class="'.$text.'"';
}else{
$this->tag_class=null;
}
}
public function parseHTML(){
if(!empty($this->url)){
$content = file_get_contents($this->url);
preg_match_all('/<'.$this->tag.$this->tag_class.'>(.*)<\/'.$this->tag.'>/Uis',$content,$result,PREG_PATTERN_ORDER);
return $result[0];
}
}
}
class Data{
public $votes = 'votes.txt';
public function setFilePath($text){
if(!empty($text)){
$this->votes = $text;
}
}
public function saveData($data){
$data = serialize($data);
file_put_contents($this->votes,$data);
}
public function loadData($file){
if(!empty($file)){
$data = file_get_contents($file);
return unserialize($data);
}
}
}