hmphu/deathbycaptcha

DeathByCaptcha 扩展

1.0.0 2016-02-23 07:53 UTC

This package is auto-updated.

Last update: 2024-09-05 17:53:42 UTC


README

DeathByCaptcha API 的非官方 PHP 封装 DeathByCaptcha API

安装

安装此扩展的首选方式是通过 composer。

运行以下命令:

php composer.phar require --prefer-dist hmphu/deathbycaptcha

或添加以下内容到您的 composer.json 的 require 部分:

"hmphu/deathbycaptcha": "*"

使用方法

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 */
}

作者和贡献者

用爱为 DeathByCaptcha 服务制作

2016年,PhuHM (@hmphu), http://hmphu.com

支持或联系

遇到问题? 联系我