定制 athlon1600/php-captcha-solver 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

athlon1600/php-captcha-solver

Composer 安装命令:

composer require athlon1600/php-captcha-solver

包简介

README 文档

README

Works for solving captchas when scraping Google, YouTube, and other sites that use ReCaptcha.

ReCaptcha V2

Official PHP library from 2captcha did not work too well, so this was built.

<?php

use CaptchaSolver\TwoCaptcha\Client;
use CaptchaSolver\TwoCaptcha\InRequest;

$captcha = new Client([
    'key' => 'API_KEY_GOES_HERE',
    'proxy' => null // optional
]);

$request = new InRequest([
    'googlekey' => '',
    'pageurl' => ''
]);

$response = $captcha->send($request);
$id = $response->getResult();

sleep(45);

$response = $captcha->getResult($id);
$solution = $response->getSolution();

// or combine the two calls into one that polls automatically every 5 seconds and times out after 90 seconds:

$response = $captcha->solveReCaptchaV2($request, 90);

$solution should now hold a "solution" token that looks something like this:

03AGdBq24bamED8AtWElXZw9ceNn53tjN7fQ76dhyIbS_LS_5xWJuOXUb9ExnYUe_H3lvpKhZMX0Z7qmA-Ia9OBrbOu4eJYh2kosO89ZyTwADK8VrMXmQ8MD3NzaQeDg5jriopB9FrheDo7BemayGgqfJydtsRoJ_hg-RpDhzcwlUgLxJ9w4FwUd-IYBbGaMHp1wP4lbqMOpOaX21_D908LwZZgK2Dgc0TfJBTi_UL8r01sAYcvj2nouFG7JQCfXuj5LIzB8JL0Rxydig11sLayKIRbea66Jd_VkOj8h2xdC4NgDkY9OGkpRE

submit the captcha form given to you with that solution as g-recaptcha-response field along with any other relevant form fields, and you are done!

Installation

composer require athlon1600/php-captcha-solver

Testing

A useful mini web-application can be launched via:

php -S localhost:8000 -t public

and then visit:
http://localhost:8000/2captcha.php

Known issues

Sometimes solving the captcha will not get you through, and instead you would just get this message at the end:

so at this point there is not much else you can do other than not make any requests for a while until Google automatically unblocks your IP address.

Misc stuff

Make 'g-recaptcha-response' textarea visible on page:

document.getElementById('g-recaptcha-response').style = null;

athlon1600/php-captcha-solver 适用场景与选型建议

athlon1600/php-captcha-solver 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.52k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2020 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 athlon1600/php-captcha-solver 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 athlon1600/php-captcha-solver 我们能提供哪些服务?
定制开发 / 二次开发

基于 athlon1600/php-captcha-solver 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6.52k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 8
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-15