How to solve Cloudflare Challenge

Logo of Capsolver

CapSolver Blogger

How to use capsolver

11-May-2023

How to solve Cloudflare Challenge

Challenges Supported by Capsolver

  • Challenge + Turnstile

  • Challenge

If it's challenge + captcha, you don't need to put any special parameter in the createTask, as we will recognize that require to solve the captcha.

How to solve Cloudflare Challenge (5s IUAM)

Before we start solving Cloudflare, there are some requeriments and points that we need to be aware that they are needed to know
Requeriments:

  • Capsolver Key
  • Proxy

Points to be aware that if we don't follow, solution will be invalid:

  • Token returned in the response of the method getTaskResult is the value of the cookie cf_clearance that you will need to create.
  • Must use the same user-agent that the method getTaskResult return
  • Must use the same proxy IP used for solve the challenge
  • Must use the cookies of the response
  • Must use the headers of the response
  • Use TLS chrome 120 version

To solve cloudflare challenge, follow our documentation. Some parameters are required and some are optional.
For this example, we will only use the required parameters. The task types for cloudflare are:

  • AntiCloudflareTask: This task type requires your own proxies.

We will use AntiCloudflareTask as the site uses Cloudflare Challenge 5s.
If any parameters are missing or you don't submit correctly, you will likely encounter issues with the token not being accepted by the website. You can find all the parameters in this picture:

Task Object Structure for solve Cloudflare Challenge 5s (cf_clearance)

Step 1: Submitting the information to capsolver

Use the method createTask to submit the information required:

POST https://api.capsolver.com/createTask

{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "AntiCloudflareTask",
    "websiteURL": "https://www.yourwebsite.com",
    "proxy": "158.120.100.23:334:user:pass"
  }
}

Step 2: Getting the results

To verify the results, you'll need to continuously poll the getTaskResult API endpoint until the captcha is resolved.

Here's an example request:

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json

{
    "clientKey":"YOUR_API_KEY",
    "taskId": "TASKID_OF_CREATETASK" //ID created by the createTask method
}

Once the captcha is successfully resolved, you'll receive a response similar to the one depicted in the following image:

{
    "errorId": 0,
    "taskId": "d8d3a8b4-30cc-4b09-802a-a476ca17fa54",
    "status": "ready",
    "solution": {
        "accept-language": "en-US,en;q=0.9",
        "cookies": {

        },
        "headers": {
            "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
            "accept-encoding": "gzip, deflate, br",
            "accept-language": "en-US,en;q=0.9",
            "cache-control": "max-age=0",
            "content-type": "application/x-www-form-urlencoded",
            "origin": "",
            "referer": "",
            "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
            "sec-ch-ua-arch": "\"arm\"",
            "sec-ch-ua-bitness": "\"64\"",
            "sec-ch-ua-full-version": "\"120.0.6099.71\"",
            "sec-ch-ua-full-version-list": "\"Not_A Brand\";v=\"8.0.0.0\", \"Chromium\";v=\"120.0.6099.71\", \"Google Chrome\";v=\"120.0.6099.71\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-model": "\"\"",
            "sec-ch-ua-platform": "\"macOS\"",
            "sec-ch-ua-platform-version": "\"10.14.6\"",
            "sec-fetch-dest": "document",
            "sec-fetch-mode": "navigate",
            "sec-fetch-site": "same-origin",
            "sec-fetch-user": "?1",
            "upgrade-insecure-requests": "1",
            "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
        },
        "proxy": "your proxy",
        "token": "cf clearance token",
        "type": "challenge",
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
    }
}

The captcha token received can be verified by submitting the cookie cf_clearance with the value of the response token, use the same proxy IP used for solve the challenge, cookies, TLS chrome 120, headers and also the same user-agent that we return you in the response to the relevant site.

⚠️ If the token is rejected, it may indicate that some information is missing or incorrect. Make sure that you are submitting the token value correctly to the cookie cf_clearance, that you are using the same proxy IP used for solve the challenge, TLS chrome 120, headers of the response and also the same user-agent that it's returned to you in the response.

If you want to solve Cloudflare Turnstile Captcha. Please refer to this blog: link

In conclusion, while solving cloudflare challenge may seem a daunting task, capsolver.com makes the process swift and efficient. By following the steps outlined above, you can easily resolve cloudflare.

Capsolver Team 💜

Ещеe

cloudflare turnstile captcha
Как решить капчу Cloudflare Turnstile: лучший решатель капчи

В этой статье мы рассмотрим лучшие решения для решения Cloudflare Turnstile, обеспечивая непрерывность и эффективность ваших операций.

Cloudflare

16-Jul-2024

Cloudflare Ошибка 1006, 1007, 1008
Cloudflare Error 1006, 1007, 1008 Решение | Как исправить

Затрудняетесь с ошибками Cloudflare 1006, 1007 или 1008? Узнайте о практических решениях для устранения этих отказов в доступе и улучшения работы веб-сервиса.

Cloudflare

13-Jun-2024

Решение проблемы Cloudflare с помощью Python и Selenium
Как обойти и решить CAPTCHA от Cloudflare с помощью Python и Selenium

Затрудняетесь с Cloudflare Captcha? Узнайте, как справиться с ней с помощью Python и Selenium! В этом руководстве рассказывается о том, что такое Cloudflare Captcha, и предлагаются эффективные решения для веб-скрапинга в 2024 году.

Cloudflare

05-Jun-2024

AI Web Unblocker для веб-скрапинга
AI Web Unblocker для веб-скрапинга всего | Самый быстрый сервис решения капчи

Преодолейте барьеры веб-скреппинга с помощью AI Web Unblocker и сверхбыстрого распознавания капчи, превратив извлечение данных в легкое дело.

Cloudflare

31-May-2024

Как решить Cloudflare
Как решить Cloudflare

В этой статье мы научим вас, что такое Cloudflare и как легко обойти Cloudflare.

Cloudflare

28-May-2023

Как решить Cloudflare Turnstile
Как решить Cloudflare Turnstile

В этой статье мы научим вас, что такое Cloudflare Turnstile и как легко обойти новую капчу Cloudflare под названием Turnstile с помощью CapSolver.

Cloudflare

26-May-2023