Blog
How to solve Cloudflare Challenge (5s)

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 💜

More

How to Solve Cloudflare when Web Scraping in 2024 | Step by Step Guide
How to Solve Cloudflare when Web Scraping in 2024 | Step by Step Guide

This blog post delves into effective techniques for solve these defenses with the help of CapSolver, a tool adept at resolving CAPTCHAs. From explaining Cloudflare's security protocols to providing practical strategies and code samples for circumventing these restrictions.

Cloudflare

07-May-2024

How to Solve Cloudflare in 2024: Solve Cloudflare Turnstile and Challenge By Using CapSolver
How to Solve Cloudflare in 2024: Solve Cloudflare Turnstile and Challenge By Using CapSolver

navigating Cloudflare's sophisticated security barriers like the Turnstile and Challenge CAPTCHA remains a critical task for many users. This blog post explores effective methods to bypass these protections using CapSolver, a tool designed for solving CAPTCHAs efficiently. Covering everything from understanding Cloudflare's security measures to practical strategies and code examples for overcoming the barriers, this guide is essential for anyone looking to access Cloudflare-protected sites without interruptions.

Cloudflare

07-May-2024

How to solve cloudflare captcha
How to solve cloudflare captcha | Solve cloudflare captcha

Cloudflare CAPTCHA serves as a vital security measure to protect websites from automated bots and ensure a safe browsing experience for users...

Cloudflare

19-Apr-2024

How to solve cloudflare turnstile and challenge 5s
How to solve cloudflare turnstile and challenge 5s in 2024 | Best Cloudflare solver

However, as a web user or developer, encountering these security measures can sometimes be a hindrance. This article will guide you...

Cloudflare

19-Apr-2024

How to solve Cloudflare Challenge with Python
How to solve Cloudflare Challenge with Python

In this article, we will show you how to solve cloudflare challenge with Python.

Cloudflare

15-Sep-2023

Wie man die Cloudflare Herausforderung löst
Wie man die Cloudflare Herausforderung löst

Mit Capsolver die Cloudflare-Herausforderung meistern: Einfache Schritte, um 5s IUAM zu lösen, mit wichtigen Tipps und API-Anleitungen für effiziente Ergebnisse

Cloudflare

06-Jun-2023