Advertisement
badaicreator

tesseract.php

Aug 4th, 2015
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. * Simple Master OCR API PHP
  4. * With Imagemagick Converting
  5. * CREATED BY Gilang Dandug
  6. * FACEBOOK  : http://www.facebook.com/indravanthoni
  7. * TWITTER   : http://www.twitter.com/1ndr4_real
  8. * EMAIl         : indrascreamo01@gmail.com
  9. * Use For Host With Tesseract OCR
  10. * Did'nt Work For Hosting not support tesseract OCR
  11. * Install Tesseract : https://code.google.com/p/tesseract-ocr/wiki/Compiling
  12. */
  13. error_reporting(0);
  14.                 function varokah($url) //Fungsi Bypass Captcha
  15.         {
  16.                         $ch = curl_init($url);
  17.                         curl_setopt($ch,CURLOPT_COOKIEJAR,'cookie.txt');      
  18.                         curl_setopt($ch,CURLOPT_REFERER,$url);                        
  19.                         curl_setopt($ch,CURLOPT_COOKIEFILE,'cookie.txt');                      
  20.                         curl_setopt($ch,CURLOPT_COOKIESESSION,true);
  21.                         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  22.                         curl_setopt($ch,CURLOPT_REFERER,$img);
  23.                         curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36');
  24.                         curl_setopt($ch,CURLOPT_FOLLOWLOCATION,false);
  25.                         curl_setopt($ch,CURLOPT_HEADER,0);
  26.                         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  27.                         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  28.                         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  29.                         $data = curl_exec($ch);
  30.                         curl_close($ch);
  31.                         $tmpFile = uniqid();
  32.                         $file = $tmpFile;
  33.                         $handle = fopen($file, 'a');
  34.                         fwrite($handle,$data);
  35.                         fclose($handle);
  36.                         shell_exec("convert ".$tmpFile." -colorspace Gray -depth 8 -resample 200x200 -verbose -antialias ".$tmpFile);
  37.                         shell_exec("convert ".$tmpFile."  -resize 116x56\>  ".$tmpFile);
  38.                         $cmd = "/usr/local/bin/tesseract $tmpFile $tmpFile";
  39.                         exec($cmd);
  40.                         unlink($tmpFile);
  41.                         $res = file_get_contents("$tmpFile.txt");
  42.                         unlink("$tmpFile.txt");
  43.                         $capcay = trim(str_replace("\n\n","",$res,count($res)));
  44.  
  45.                         echo $capcay;
  46.         }
  47. $url = $_GET['img'];
  48. if($_GET['img']){
  49. varokah($url);
  50. }
  51. else
  52. {
  53. echo
  54. "No Captcha Can Reorganized ";
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement