# FunCAPTCHA

FunCaptcha hay còn gọi là Arkose Labs Captcha là một loại captcha trông giống như sau:

<figure><img src="/files/HpEYoIVNTJJBWWPZr5Zw" alt=""><figcaption><p><a href="https://anticaptcha.top/dich-vu-giai-funcaptcha-uy-tin-gia-re-sieu-nhanh-tt1724.html">giải funcaptcha</a></p></figcaption></figure>

### 1. Tìm Publickey của funCAPTCHA

Publickey có thể tìm thấy bên trong tham số <mark style="color:red;">`data-pkey`</mark> của phần tử div của funcaptcha hoặc bên trong phần tử đầu vào có tên <mark style="color:red;">`fc-token`</mark> - chỉ cần trích xuất khóa được chỉ định sau `pk` từ giá trị của phần tử này.

<figure><img src="/files/PFadDN0oP3x5TItMb6m7" alt=""><figcaption></figcaption></figure>

### 2. Tạo yêu cầu/Request

<mark style="color:red;">**POST :**</mark> <mark style="color:red;"></mark><mark style="color:red;">`https://anticaptcha.top/api/captcha`</mark>

**Các tham số Body**:

<table data-header-hidden><thead><tr><th width="157">Tên trường dữ liệu</th><th width="131"></th><th width="105"></th><th></th></tr></thead><tbody><tr><td><strong>Tên trường dữ liệu</strong></td><td><strong>Kiểu dữ liệu</strong></td><td><strong>Bắt buộc</strong></td><td><strong>Mô tả</strong></td></tr><tr><td>apikey</td><td>String</td><td>x</td><td>Key duy nhất để xác định đối tác API</td></tr><tr><td>type</td><td>Interger</td><td>x</td><td>Giá trị: <mark style="color:red;"><strong>16</strong></mark></td></tr><tr><td>websitekey</td><td>String</td><td>x</td><td>Giá trị của tham số <em>pk</em> hoặc <em>data-pkey</em></td></tr><tr><td>pageurl</td><td>String</td><td>x</td><td>url của webpage hiển thị funCaptcha mà bạn muốn giải<br>Ví dụ: <a href="https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&#x26;lang=en">https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&#x26;lang=en</a><br><a href="https://client-demo.arkoselabs.com/solo-animals">https://client-demo.arkoselabs.com/solo-animals</a></td></tr><tr><td>data</td><td>String</td><td></td><td>Tham số bổ sung có thể được yêu cầu khi triển khai Funcaptcha. Sử dụng thuộc tính này để gửi giá trị "blob" dưới dạng một mảng được xâu chuỗi. Ví dụ:  {\"blob\":\"giá_trị_của_blob\"}</td></tr></tbody></table>

```http
POST HTTP
Url: https://anticaptcha.top/api/captcha
Content-Type: application/json

{
	"apikey": "YOUR_API_KEY",
	"type": 16, // id cho hCAPTCHA
	"websitekey": "804380F4-6844-FFA1-ED4E-5877CA1F1EA4", // thay bằng puclickey funcaptcha của bạn
	"pageurl": "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en" // thay bằng url của bạn
}
```

### 3. Nhận kết quả trả về/Response

Kết quả trả về dạng JSON gồm các trường sau

<table data-header-hidden><thead><tr><th width="201"></th><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Tên trường dữ liệu</strong></td><td><strong>Kiểu dữ liệu</strong></td><td><strong>Mô tả</strong></td></tr><tr><td>success</td><td>boolean</td><td><p>Mã thông báo xác định kết quả của bước gửi captcha qua POST</p><p><mark style="color:red;"><strong>true</strong></mark>: Thành công<br><mark style="color:red;"><strong>false</strong></mark>: Thất bại</p></td></tr><tr><td>message</td><td>String</td><td>Thông báo tương ứng nếu có</td></tr><tr><td>captcha</td><td>String</td><td>kết quả giải ra = token dùng để vượt funCAPTCHA</td></tr><tr><td>base64img</td><td>String</td><td>Không dùng đến</td></tr></tbody></table>

{% tabs %}
{% tab title="Thành công" %}

```json
{
	"success": true,
	"message": "Thành công",
	"captcha": "8561740a2df15f7e9.8728535301|at=40|cdn_url=https%3A%2F%2Fclient-.....", //kết quả giải ra
	"base64img": null
}
```

{% endtab %}

{% tab title="Thất bại" %}

```json
{
	"success": false,
	"message": null,
	"captcha": null,
	"base64img": null
}
```

hoặc

```json
{
	"success": false,
	"message": "Số xu không đủ",
	"captcha": ""
}
```

hoặc

```json
{
	"success": false,
	"message": "Api key không chính xác",
	"captcha": ""
}
```

{% endtab %}
{% endtabs %}

### 4. Code mẫu

{% tabs %}
{% tab title="C#" %}

```csharp
public class CatpchaResult
{
    public string log { get; set; }
    public bool status { get; set; }
    public string catcha { get; set; }
}
public class AnticaptchaTopApi
{
    public string apiKey = "";
    public string Post(string url, object data, string method = "POST")
    {
        int num = 0;
        NameValueCollection values;
        while (num < 1)
        {
            try
            {
                using (WebClient webClient = new WebClient())
                {
                    values = new NameValueCollection();
                    if (data != null)
                    {
                        data.GetType().GetProperties().ToList().ForEach(delegate (PropertyInfo pi)
                        {
                            values.Add(pi.Name, (pi.GetValue(data, null) ?? "").ToString());
                        });
                        byte[] bytes = webClient.UploadValues(url, method, values);
                        return Encoding.UTF8.GetString(bytes);
                    }
                    return webClient.DownloadString(url);
                }
             }
            catch
            {                
            }
        }
        return "";
    }
    public CatpchaResult GetCatpcha(int type=16,string websitekey,string pageurl)
    {
        var data = new
        {
            apikey = apiKey,
            type = type,
            websitekey = websitekey,
            pageurl = pageurl
        };
        var rs = new CatpchaResult
        {
            status = false
        };
        try
        {
            var result = JsonConvert.DeserializeObject<dynamic>(Post("https://anticaptcha.top/api/captcha", data));
            if (result.success == true)
            {
                rs.status = true;
                rs.catcha = result.captcha;
                rs.log = result.message;
            }
        }
        catch
        {
        }
        return rs;
    }
}
```

{% endtab %}

{% tab title="PHP Curl" %}

```php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://anticaptcha.top/api/captcha",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"apikey\"\r\n\r\n[apikey]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\n16\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"websitekey\"\r\n\r\n804380F4-6844-FFA1-ED4E-5877CA1F1EA4\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"pageurl\"\r\n\r\n[url chứa funcaptcha]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}

{% tab title="Javascript Jquery AJAX" %}

```javascript
var form = new FormData();
form.append("apikey", "[apikey]");
form.append("type", "16");
form.append("websitekey", "804380F4-6844-FFA1-ED4E-5877CA1F1EA4");
form.append("pageurl", "[url chứa funcaptcha]");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://anticaptcha.top/api/captcha",
  "method": "POST",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endtab %}
{% endtabs %}

### 5. Sử dụng kết quả token nhận được

Định vị phần tử có id fc-token và đưa token nhận được vào giá trị của phần tử này.\
Làm phần còn lại những gì bạn cần làm trên trang web: submit form hoặc nhấp vào nút hoặc thứ gì đó khác

{% hint style="info" %} <mark style="color:red;">**Xin lưu ý**</mark>: đôi khi nội dung trên trang được tạo động và bạn sẽ không thấy phần tử này trong mã nguồn html. Trong những trường hợp như vậy, bạn phải khám phá mã javascript mà tạo ra nội dung. Tùy chọn "Inspect" (F12) trong Google Chrome có thể giúp ích trong việc đó.
{% endhint %}

### *<mark style="color:red;">Lưu ý</mark>:* Nên sử dụng phần mềm PostMan để kiểm tra chạy test trước


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.anticaptcha.top/su-dung-api/api-giai-captcha/funcaptcha.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
