Geetest v4
Geetest v4 Captcha Recognition API
Section titled “Geetest v4 Captcha Recognition API”POST https://api.captchasonic.com/createTaskHost: api.captchasonic.comContent-Type: application/json
Payload
Section titled “Payload”{ "apiKey": "YOUR_API_KEY", "task": { "type": "GeetestImage", "queries": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "examples": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "question": "slide", "websiteURL": "https://your-website.com", "websiteKEY": "website-key" }}
Response
Section titled “Response”{ "code": 200, "msg": "", "answers": { "slide": [ 175, 115 ], "taskId": "" }}
Example Scripts
Section titled “Example Scripts”async function fetch_geetest_result() {const url = "https://api.captchasonic.com/createTask"; // Replace with the actual API endpoint
const data = {"apiKey": "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxx","task": { "type": "GeetestImage", "queries": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "examples": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "question": "slide", "websiteURL": "https://your-website.com", "websiteKEY": "website-key"}}
try {const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data)});
if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`);}
const result = await response.json();console.log("Response:", result);return result;} catch (error) {console.error("Error fetching OCR result:", error);return null;}}
// Example usage:fetch_geetest_result();
import requests
def fetch_geetest_result(): url = "https://api.captchasonic.com/createTask" # Replace with the actual API endpoint headers = {"Content-Type": "application/json"}
data = { "apiKey": "sonic_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "task": { "type": "GeetestImage", "queries": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "examples": [ "iVBORw0KGgoAAAANSUhEUgAAASwAAADICAIAAADdvUsCAAAgAElEQVR4AezBCZRd9X0n...." ], "question": "slide", "websiteURL": "https://your-website.com", "websiteKEY": "website-key" } }
try: response = requests.post(url, json=data, headers=headers) response.raise_for_status() # Raise an error for HTTP error responses return response.json() # Return JSON response except requests.exceptions.RequestException as e: print(f"Error fetching result: {e}") return None
# Example usage: result = fetch_geetest_result() if result: print("Response:", result)