Advertisement
hielasangre

[ TSE Captcha Reader ]

Oct 31st, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <?php
  2. class tsepwner{
  3.     private $url;
  4.     private $sourcecode;
  5.     private $captcha;
  6.     public function getSourceCode($target){
  7.         $this->url=$target;
  8.         $curl = curl_init();
  9.         curl_setopt($curl, CURLOPT_URL, $this->url);
  10.         curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  11.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  12.         $data = curl_exec($curl);
  13.         $this->sourcecode = $data;
  14.         curl_close($curl);
  15.         }
  16.     public function readCaptcha(){
  17.         preg_match('/<img id="picCaptcha" [^>]*src="imagenes\/([^"]*).bmp"[^>]*>/', $this->sourcecode, $this->captcha);
  18.         echo '<font size="4px">Captcha del Sitio: </font><br><image src="http://www.tse.go.cr/consulta_persona/imagenes/'.$this->captcha[1].'.bmp"><br>';
  19.         echo '<font size="4px">La combinacion de caracteres obtenida para este captcha es: </font><br><font size="6px">'.$this->captcha[1].'</font>';
  20.         }
  21.    
  22.     }
  23.    
  24. $url = "http://www.tse.go.cr/consulta_persona/consulta_cedula.aspx";
  25. $pwn=new tsepwner();
  26. $pwn->getSourceCode($url);
  27. $pwn->readCaptcha();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement