示例#1
0
 /**
  * Genera Img Captcha
  *
  */
 public function captcha()
 {
     Load::lib('captcha/captcha');
     View::select(NULL, NULL);
     $captcha = new Captcha();
     $captcha->run();
 }
 /**
  * Obsługa DBC - rozwiązywanie captcha
  * @param string $captchaUrl
  */
 public static function fixCaptcha($captchaUrl)
 {
     $captchaFile = dirname(__FILE__) . '/captcha/' . uniqid('captcha') . '.png';
     file_put_contents($captchaFile, PlayMobile::curl($captchaUrl));
     if (PlayMobile::$captchaService == 'deathbycaptcha.com') {
         require_once 'vendor/deathbycaptcha.php';
         $client = new DeathByCaptcha_SocketClient(PlayMobile::$dbcUser, PlayMobile::$dbcPass);
         $captcha = $client->decode($captchaFile, DeathByCaptcha_Client::DEFAULT_TIMEOUT);
         $captcha = $captcha['text'];
     } else {
         require_once 'vendor/Captcha.php';
         $client = new Captcha();
         $client->domain = PlayMobile::$captchaService;
         $client->setApiKey(PlayMobile::$captchaApiKey);
         if ($client->run($captchaFile)) {
             $captcha = $client->result();
         } else {
             $captcha = NULL;
         }
     }
     if ($captcha) {
         @unlink($captchaFile);
         print "Captcha: {$captcha}\n";
         return $captcha;
     } else {
         @unlink($captchaFile);
         return FALSE;
     }
 }