/** * @see DeathByCaptcha_Client::__construct() */ public function __construct($username, $password) { // PHP for Windows lacks EAGAIN errno constant if (!defined('SOCKET_EAGAIN')) { define('SOCKET_EAGAIN', 11); } foreach (array('json') as $k) { if (!extension_loaded($k)) { throw new DeathByCaptcha_RuntimeException("Required {$k} extension not found, check your PHP configuration"); } } foreach (array('json_encode', 'json_decode', 'base64_encode') as $k) { if (!function_exists($k)) { throw new DeathByCaptcha_RuntimeException("Required {$k}() function not found, check your PHP configuration"); } } parent::__construct($username, $password); }
/** * Reports incorrectly decoded CAPTCHA * * @param int $major_id * @param int $minor_id * @return int Error code */ public function picture_bad2($major_id, $minor_id) { if ($this->status != sCCC_PICTURE) { return ccERR_STATUS; } else { try { $this->_client->report($major_id); return ccERR_OK; } catch (Exception $e) { return ccERR_NET_ERROR; } } }