最佳 Cloudflare Challenge 解决方案

Cloudflare Challenge 解决方案

什么是 Cloudflare Challenge

Cloudflare Challenge 是一种机器人防御机制,使用 JavaScript 挑战、浏览器指纹识别和验证码作为后备机制,以检测并阻断自动化或可疑流量。

了解更多 Cloudflare Challenge 验证码解决方案信息

如何解决 Cloudflare Challenge - API 指南

CapSolver 自动验证码识别服务可以轻松解决 Cloudflare Challenge,我们的服务可以通过 CapSolver 的 API 使用。注册 CapSolver 并获取我们的验证码服务。

Step 1 : Creating a Task

Create the task with the createTask.

In the process of using challenge, we must input websiteURL and websiteKey, other parameters are optional.

Task Object Structure

Properties Type Required Description
type String Required AntiCloudflareTask
websiteURL String Required The address of the target page.
proxy String Required Your Static proxy or Sticky proxy. Learn Using proxies
userAgent String Optional The user-agent you used to request the target website. Only Chrome's userAgent is supported.
html String Optional The response of requesting the target website, it usually contains "Just a moment..." and status code is 403. we need this html for some websites, please be sure to use your sticky proxy to dynamically scrape the HTML every time.

Example Request

txt Copy
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
json lines Copy
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "AntiCloudflareTask",
    "websiteURL": "https://www.yourwebsite.com",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
    "html": "<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title>...",
    "proxy": "ip:port:user:pass"
  }
}

Example Response

json lines Copy
{
  "errorId": 0,
  "status": "idle",
  "taskId": "df944101-64ac-468d-bc9f-41baecc3b8ca"
}

Step 2 : Getting Results

Use the getTaskResult method to get the recognition results

Depending on the system load, you will get the results within the interval of 1s to 20s

Example Request

txt Copy
POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
json lines Copy
{
  "clientKey": "YOUR_API_KEY",
  "taskId": "df944101-64ac-468d-bc9f-41baecc3b8ca"
}

Example Response

json lines Copy
{
  "errorId": 0,
  "taskId": "df944101-64ac-468d-bc9f-41baecc3b8ca",
  "status": "ready",
  "errorCode": "",
  "errorDescription": "",
  "solution": {
    "cookies": {
        "cf_clearance": "Bcg6jNLzTVaa3IsFhtDI.e4_LX8p7q7zFYHF7wiHPo...uya1bbdfwBEi3tNNQpc"
    },
    "token": "Bcg6jNLzTVaa3IsFhtDI.e4_LX8p7q7zFYHF7wiHPo...uya1bbdfwBEi3tNNQpc",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
  }
}

使用 CapSolver SDK 解决 Cloudflare Challenge

支持主流验证码

轻松使用 CapSolver 解决验证码

我们确保将我们的产品集成到您的基础设施中尽可能轻松。凭借多语言支持和开箱即用的代码示例,保证您的 Web 项目能够快速轻松地启动。

开发者文档

免费试用

识别广泛的验证码类型

reCAPTCHA v2 / v3
Cloudflare Challenge
AWS WAF
图像转文本 (OCR)
Cloudflare Turnstile
更多类型

确保合规监管适用于所有用户

Compliance badges including CCPA, GDPR, and ISO

在我们的核心价值观中,我们倡导合乎道德地使用技术以增进人类福祉,并坚决反对任何非法行为和对我们解决方案的不当使用。我们支持负责任地聚合公开可访问的数据以丰富人类生活,同时强烈谴责在未经适当授权的情况下非法收集敏感数据。如果您发现任何利用我们平台进行不当行为的个人,我们强烈建议您举报此类不端行为。为了增强信任并赋予用户更多的自主权与知识,我们推出了专门的隐私中心,旨在为个人提供更完善的工具和关于其数据权利的深入见解。