01/10
2016
DeathByCaptcha extension
Unofficial PHP wrapper for DeathByCaptcha API, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist hmphu/deathbycaptcha
or add, (*4)
"hmphu/deathbycaptcha": "*"
to the require section of your composer.json., (*5)
use hmphu\deathbycaptcha\DeathByCaptchaSocketClient; use hmphu\deathbycaptcha\DeathByCaptchaClient; $deathByCaptchaUser = 'Your DBC API Username Here'; $deathByCaptchaPassword = 'Your DBC API Password Here'; $client = new DeathByCaptchaSocketClient($deathByCaptchaUser, $deathByCaptchaPassword); try { $balance = $client->get_balance(); if($balance > 0){ /* Put your CAPTCHA file name or opened file handler, and optional solving timeout (in seconds) here: */ $captcha = $client->decode($img, DeathByCaptchaClient::DEFAULT_TIMEOUT * 2); if ($captcha) { $text = $captcha['text']; } } } catch (DeathByCaptchaAccessDeniedException $e) { /* Access to DBC API denied, check your credentials and/or balance */ }
Make with love to DeathByCaptcha service, (*6)
In 2016, PhuHM (@hmphu), http://hmphu.com, (*7)
Having trouble? [contact me][3], (*8)