承接 greezlu/capsolver-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

greezlu/capsolver-php

最新稳定版本:0.9.4

Composer 安装命令:

composer require greezlu/capsolver-php

包简介

README 文档

README

The simple client for CapSolver captcha solving service.

Installation

This package can be installed via composer.

Composer

composer require greezlu/capsolver-php

Configuration

CapsolverClient instance can be created like this:

$solver = new \Capsolver\CapsolverClient('YOUR_API_KEY');

Solve captcha

Find more information about request and response in the related documentation page.

ReCaptcha v3

More in the documentation.

Request:

$solution = $solver->recaptchaV3(
    \Capsolver\Solvers\Token\ReCaptchaV3::TASK,
    [
      'websiteURL'    => 'https://www.google.com/recaptcha/api2/demo',
      'websiteKey'    => '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
      'pageAction'    => 'verify',
      'minScore'      => 0.6,
      'proxy'         => 'http:ip:port:user:pass'
    ]
);

Response:

$solution = [
    'userAgent' => 'xxx',
    'expireTime' => 1671615324290,
    'gRecaptchaResponse' => '3AHJ...'
];

ReCaptcha v2

More in the documentation.

Request:

$solution = $solver->recaptchaV2(
    \Capsolver\Solvers\Token\ReCaptchaV2::TASK,
    [
      'websiteURL'    => 'https://www.google.com/recaptcha/api2/demo',
      'websiteKey'    => '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
      'proxy'         => 'http:ip:port:user:pass'
    ]
);

Response:

$solution = [
    'userAgent' => 'xxx',
    'expireTime' => 1671615324290,
    'gRecaptchaResponse' => '3AHJ...'
];

Cloudflare Turnstile

More in the documentation.

Request:

$solution = $solver->turnsite([
    'websiteURL'    => 'https://www.yourwebsite.com',
    'websiteKey'    => '0x4XXXXXXXXXXXXXXXXX',
    'metadata'      => [
        'action'        => 'login', //optional
        'cdata'         => '0000-1111-2222-3333-example-cdata' //optional
    ]
]);

Response:

$result = [
    'token'     => "0.mF74FV8wEuf...",
    'type'      => 'turnstile',
    'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)...'
];

Error handling

If case of an error solver throws an instance of CapsolverException exception.

try {
    $solution = $solver->recaptchaV3('', []);
} catch (\Capsolver\Exceptions\RequestException $error) {
    // Error happened before api request
} catch (\Capsolver\Exceptions\ResponseException $error) {
    // Error happened after api request
} catch (\Capsolver\Exceptions\CapsolverException $error) {
    // General error
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-28