### ReCaptchaV2 Submission URL Example Source: https://docs.cap.guru/en/apitoken/recap2 This is a GET request example for submitting a ReCaptchaV2 solving task. It includes the API key, method, google key, and page URL as query parameters. This format is simpler for quick tests but HTTP POST with JSON is generally recommended for production. ```http http://api2.cap.guru/in.php?key=YOUR_APIKEY&method=userrecaptcha&googlekey=6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-&pageurl=https://www.google.com/recaptcha/api2/demo ``` -------------------------------- ### Get CAPTCHA Solution from Cap.guru API (JavaScript) Source: https://docs.cap.guru/en/apiclick/aws This JavaScript example illustrates how to fetch the solution for a CAPTCHA from the Cap.guru API using its ID. It requires the CAPTCHA ID obtained after uploading the image. The function polls the result endpoint until a solution is available. ```javascript async function getCaptchaSolution(apiKey, captchaId) { const resultUrl = `http://api2.cap.guru/res.php?key=${apiKey}&action=get&id=${captchaId}&json=1`; let solution = null; while (solution === null) { try { const response = await fetch(resultUrl); const result = await response.json(); if (result.status === 1) { solution = result.request; } else { await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds } } catch (error) { console.error("Error fetching captcha solution:", error); await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds on error } } return solution; } ``` -------------------------------- ### CapGuru API Integration with C# Source: https://docs.cap.guru/en/apiclick/text This C# example demonstrates how to send an image to the CapGuru API for recognition. It includes functions for encoding the image to base64, making HTTP POST requests to submit the image and API key, and then making subsequent GET requests to retrieve the recognition results. The code handles potential API response variations and includes logging. ```csharp string img = project.Variables["image"].Value; string key = project.Variables["capguru_apikey"].Value; string result = project.Variables["result"].Value; img = EncodeString(img); string text12 = "method=base64&key="+key+"&body="+img+"&vernet=0"; var answer = ZennoPoster.HTTP.Request( method: ZennoLab.InterfacesLibrary.Enums.Http.HttpMethod.POST, url: @"http://api.cap.guru/in.php", content: text12, respType: ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly ); info("Get id:" +answer ); if(answer.Contains("OK")){ var answerInt = Regex.Replace(answer,@"[^0-9]","1"); Thread.Sleep(4000); answer = ZennoPoster.HTTP.Request( method: ZennoLab.InterfacesLibrary.Enums.Http.HttpMethod.GET, url: @"http://api.cap.guru/res.php?action=get&id="+answerInt+"&key="+key, respType:ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly); if(answer.Contains("OK")){ //result = new string(answer.Split("|")[1]); var parts2 = answer.Substring(3); project.Variables["result"].Value =parts2; } info("Result: " +answer ); } void info(string word){ project.SendInfoToLog(word.ToString(), "[CapGuru][IMG]", true); } string EncodeString(string str){ int maxLengthAllowed = 65519; StringBuilder sb = new StringBuilder(); int loops = str.Length / maxLengthAllowed; for (int i = 0; i <= loops; i++){ sb.Append(Uri.EscapeDataString(i < loops ? str.Substring(maxLengthAllowed * i, maxLengthAllowed) : str.Substring(maxLengthAllowed * i))); } return sb.ToString(); } ``` -------------------------------- ### Solve CAPTCHA using Node.js and CapGuru API Source: https://docs.cap.guru/en/apiclick/recap This Node.js example uses the 'request' module to interact with the CapGuru API. It defines functions to get base64 image data, send it to the API, and poll for the solution. Asynchronous operations are handled using Promises and async/await. ```javascript var request = require('request'); var img = getBinanceBase64(); var YOUR_API_KEY = "17a1f02f43bfb8025f4ef3a56fc425cf"; (async() => { var waw = await k(img); console.log(waw); })(); function delay(time) { return new Promise(function(resolve) { setTimeout(resolve, time) }); } async function k(img) { return new Promise(async function(resolve2) { let buffurl1 = img var myJSONObject = { "key": YOUR_API_KEY, "method": "base64", "click": "recap2", "textinstructions": "car", "body": buffurl1, }; request({ url: "http://api.cap.guru/in.php", method: "POST", json: true, body: myJSONObject }, async function(error, response, body) { console.log(body); id = body.split("|")[1] let res = await delay(2000).then(async() => { let res2 = await get_result_request(id); console.log(res2); dd = res2.split("|")[1] resolve2(dd ) }); }); }); function get_result_request(id) { return new Promise(async resolve => { return await request.get('http://api.cap.guru/res.php?key=' + YOUR_API_KEY + '&id=' + id + '&action=get', async function(error2, response2, body2) { resolve(body2); }) }); } } function getBinanceBase64(){ } ``` -------------------------------- ### Captcha Response Example (JSON) Source: https://docs.cap.guru/en/apiclick/binance An example of a successful JSON response from the Cap.Guru API after a captcha has been solved. It includes the status and the solved captcha data. ```json { "status": 1, "request": "coordinate:x=44,y=32" } ``` -------------------------------- ### Receiving CAPTCHA Solving Response from Cap.guru API (Plain Text) Source: https://docs.cap.guru/en/apiclick/temu This example illustrates how to retrieve the result of a CAPTCHA solving task from the Cap.guru API in plain text format. It requires the user's API key, the action type ('get'), and the ID of the submitted task. The response contains the solved CAPTCHA ID. ```HTTP POST http://api2.cap.guru/res.php Host: api2.cap.guru Content-Type: application/x-www-form-urlencoded Content-Length: [YOUR_LENGTH] key=[YOUR_API_KEY]&action=get&id=65787087 ``` -------------------------------- ### Cap.Guru API Request Example (HTTP/JSON) Source: https://docs.cap.guru/en/apiclick/other/linkvertise This snippet shows a sample HTTP POST request to the Cap.Guru API, including headers and a JSON payload. The request is used to perform actions like fetching coordinates. Ensure you replace 'YOUR_API_KEY' with your actual key. ```http POST http://api2.cap.guru/res.php Host: api2.cap.guru Content-Type: application/json ``` ```json { "key": "YOUR_API_KEY", "action": "get", "id": "XXXXXXXXXXXXXXXXXX", // for example 65787087 "json": 1 } ``` -------------------------------- ### Get CAPTCHA Solution from Cap.guru API (PHP) Source: https://docs.cap.guru/en/apiclick/aws This PHP code retrieves the CAPTCHA solution from the Cap.guru API using the CAPTCHA ID. It makes GET requests to the result endpoint and polls until the solution is available. Ensure cURL is enabled in your PHP installation. ```php ``` -------------------------------- ### Implement a Simple Cache (C#) Source: https://docs.cap.guru/en/apiclick/other/seofast This C# code implements a basic in-memory cache using a Dictionary. It allows adding and retrieving items by key. The cache has a capacity limit, and older items are not explicitly evicted in this simple implementation. ```csharp using System.Collections.Generic; public class SimpleCache { private Dictionary cache = new Dictionary(); private int capacity; public SimpleCache(int capacity) { this.capacity = capacity; } public void Add(TKey key, TValue value) { if (cache.Count >= capacity) { // In a real cache, implement eviction strategy here // For simplicity, we'll just not add if full return; } cache[key] = value; } public TValue Get(TKey key) { if (cache.ContainsKey(key)) { return cache[key]; } return default(TValue); } } ``` -------------------------------- ### Sending Turnstile Solving Request (HTTP GET) Source: https://docs.cap.guru/en/apitoken/turnstile This example demonstrates how to send a request to the CapGuru API to solve a Cloudflare Turnstile challenge using an HTTP GET request. It requires your API key, the method 'turnstile', the 'sitekey' obtained from the webpage, and the 'pageurl'. The 'json' parameter can be set to 1 for a JSON response. ```http http://api2.cap.guru/in.php?key=YOUR_APIKEY&method=turnstile&sitekey=1x00000000000000000000AA&pageurl=https://react-turnstile.vercel.app/basic ``` -------------------------------- ### Process and Display User Data (Java) Source: https://docs.cap.guru/en/apiclick/other/seofast This Java code snippet demonstrates processing and displaying user data. It includes methods for fetching user information and printing it to the console. It likely interacts with a data source or service to retrieve user details. ```java public class UserProcessor { public void processAndDisplayUser(String userId) { // Assume fetching user data from a service or database String userData = fetchUserData(userId); System.out.println("User Data for " + userId + ": " + userData); } private String fetchUserData(String userId) { // Placeholder for actual data fetching logic return "User Name: John Doe, Email: john.doe@example.com"; } } ``` -------------------------------- ### Getting Turnstile Solving Response (HTTP POST JSON) Source: https://docs.cap.guru/en/apitoken/turnstile This example shows how to retrieve the solution for a Cloudflare Turnstile challenge from the CapGuru API using an HTTP POST request with a JSON body. You need to provide your API key, the action 'get', the captcha 'id' received from the initial request, and set 'json' to 1 for a JSON response. ```http POST http://api2.cap.guru/res.php Host: api2.cap.guru Content-Type: application/json { "key": "YOUR_API_KEY", "action": "get", "id": "XXXXXXXXXXXXXXXXXX", "json": 1 } ``` -------------------------------- ### POST /in.php - Send Image and Instructions Source: https://docs.cap.guru/en/apiclick/temu This endpoint is used to send images and associated instructions to the Cap.Guru service. It can handle base64 encoded images and provides options for response format. ```APIDOC ## POST /in.php ### Description This endpoint allows you to send images and instructions to the Cap.Guru service for processing. You can specify the method of encoding and the desired response format (plain text or JSON). ### Method POST ### Endpoint http://api2.cap.guru/in.php ### Parameters #### Query Parameters - **key** (String) - Yes - The API key for authentication. - **method** (String) - Yes - Set to 'base64' for base64 encoded data. - **textinstructions** (String) - Yes - Instructions for the task, e.g., "Please click on the smaller yellow sphere." Tasks are supported only in English. - **click** (String) - Yes - Specifies the click mechanism, e.g., 'temu'. - **body0** (String) - Yes* - The first image encoded in Base64 format, without the 'data:image/png;base64,' prefix. - **body1** (String) - Yes* - The second image encoded in Base64 format, without the 'data:image/png;base64,' prefix. (Optional, depends on task requirements) - **json** (Number) - No - By default: 0. Set to 1 to receive a JSON response; otherwise, a plain text response is sent. ``` -------------------------------- ### Set up Chrome WebDriver Source: https://docs.cap.guru/en/modules/selenium Initializes the Chrome WebDriver with specific options to disable automation detection and clear the browser cache. This setup is crucial for bypassing bot detection mechanisms on websites like TikTok. ```python from selenium import webdriver # Set up Chrome WebDriver options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) driver = webdriver.Chrome(options=options) driver.execute_cdp_cmd("Network.clearBrowserCache", {}) ``` -------------------------------- ### Solve Geetest CAPTCHA with Base64 Image (Python, PHP, Node.js) Source: https://docs.cap.guru/en/apiclick/geetest These examples demonstrate how to solve a 'geetest' CAPTCHA by sending a base64 encoded image to the Cap.Guru API. The process involves uploading the image, waiting for the CAPTCHA to be solved, and then retrieving the result. Dependencies include the 'requests' library for Python, built-in functions for PHP, and the 'request' library for Node.js. The input is an image URL and CAPTCHA type, and the output is the CAPTCHA solution. ```python import requests from io import BytesIO import base64 import time key = '17a1f02f43bfb8025f4ef3a56fc425cf' url = 'http://test.cap.guru/web/_images/geetest/geetestf2.png' response = requests.get(url) ee = base64.b64encode((response.content)) payload = {'textinstructions': 'slider', 'click': 'geetest', 'key': key, 'method': 'base64', 'body': ee} r = requests.post("http://api.cap.guru/in.php", data=payload) time.sleep(10) rt = r.text.split('|') url = 'http://api.cap.guru/res.php?key='+key+'&id='+rt[1] print(url); response = requests.get(url) print(response.content) ``` ```php array( 'method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://api.cap.guru/in.php', false, $context); sleep(5); //echo $server_output; echo file_get_contents("http://api.cap.guru/res.php?key=17a1f02f43bfb8025f4ef3a56fc425cf&action=get&id=".explode("|", $result)[1]); ?> ``` ```javascript var request = require('request'); var img = getBinanceBase64(); var YOUR_API_KEY = "17a1f02f43bfb8025f4ef3a56fc425cf"; (async() => { var waw = await k(img); console.log(waw); })(); function delay(time) { return new Promise(function(resolve) { setTimeout(resolve, time) }); } async function k(img) { return new Promise(async function(resolve2) { let buffurl1 = img var myJSONObject = { "key": YOUR_API_KEY, "method": "base64", "click": "geetest", "textinstructions": "slider", "body": buffurl1, }; request({ url: "http://api.cap.guru/in.php", method: "POST", json: true, body: myJSONObject }, async function(error, response, body) { console.log(body); id = body.split("|")[1] let res = await delay(2000).then(async() => { let res2 = await get_result_request(id); console.log(res2); dd = res2.split("|")[1] resolve2(dd ) }); }); }); function get_result_request(id) { return new Promise(async resolve => { return await request.get('http://api.cap.guru/res.php?key=' + YOUR_API_KEY + '&id=' + id + '&action=get', async function(error2, response2, body2) { resolve(body2); }) }); } } function getBinanceBase64(){ ``` -------------------------------- ### Get Captcha Recognition Result (API) Source: https://docs.cap.guru/en/apiclick/text This example shows how to retrieve the result of a previously submitted captcha recognition task using the Cap.Guru API. It requires the captcha ID obtained from the initial submission and specifies the desired response format (JSON). ```HTTP http://api2.cap.guru/res.php?key=YOUR_API_KEY&action=get&id=CAPTCHA_ID&json=1 ``` -------------------------------- ### Submit CAPTCHA Task (Plain Text) Source: https://docs.cap.guru/en/apiclick/geetest This example demonstrates submitting a CAPTCHA task to the Cap.Guru API with a plain text response format. This is useful for simpler integrations where JSON parsing is not required. ```bash curl -X POST 'http://api2.cap.guru/in.php' \ -H 'Content-Type: application/json' \ -d '{ "key": "YOUR_API_KEY", "method": "base64", "image": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAAQABAAAAICRAA7" }' ``` -------------------------------- ### Receiving CAPTCHA Solving Response from Cap.guru API (JSON) Source: https://docs.cap.guru/en/apiclick/temu This example shows how to retrieve the result of a CAPTCHA solving task from the Cap.guru API using JSON format. It requires the user's API key, the action type ('get'), and the ID of the previously submitted task. The response contains the status and the solved CAPTCHA ID. ```HTTP POST http://api2.cap.guru/res.php Host: api2.cap.guru Content-Type: application/json { "key": "YOUR_API_KEY", "action": "get", "id": "65787087", "json": 1 } ``` -------------------------------- ### Integrate Referral System via GET Request Source: https://docs.cap.guru/en/api/ref Developers can embed the referral system into their software by adding the 'softguru=yourid' parameter to GET requests when solving captchas. This allows tracking of referrals and earning commissions. ```url https://api.example.com/solve?captcha_id=123&softguru=100001 ```