/** * @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 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 RuntimeException("Required {$k}() function not found, check your PHP configuration"); } } parent::__construct($username, $password); }
/** * @see DeathByCaptcha_Client::__construct() */ public function __construct($username, $password) { if (!extension_loaded('curl')) { throw new RuntimeException('CURL extension not found'); } if (function_exists('json_decode')) { $this->_response_type = 'application/json'; $this->_response_parser = array($this, 'parse_json_response'); } else { $this->_response_type = 'text/plain'; $this->_response_parser = array($this, 'parse_plain_response'); } parent::__construct($username, $password); }