Teknik Açıklamalar

CaptchaAI JSON API ve Form API Karşılaştırması: Hangi Format Kullanılmalı

CaptchaAI hem form kodlu hem de JSON formatlarındaki istekleri kabul eder. Her ikisi de aynı şekilde çalışır; dilinize ve tercihlerinize göre seçim yapın.


Yan Yana Karşılaştırma

Form Kodlu (Varsayılan)

import requests

resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})

İçerik Türü: application/x-www-form-urlencoded

JSON

import requests

resp = requests.post("https://ocr.captchaai.com/in.php", json={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})

İçerik Türü: application/json


Temel Farklılıklar

Faktör Form Kodlu JSON
İçerik Türü application/x-www-form-urlencoded application/json
Veri yapısı Düz anahtar/değer çiftleri İç içe nesneler mümkün
İkili veri Dosya yüklemek için çok parçalı kullanın Base64 gövde alanında kodlama
Dizi desteği Sınırlı Yerli
Python anahtar kelimesi data={} json={}
Node.js URLSearchParams JSON.stringify()
Okunabilirlik Düz parametreler için basit Karmaşık veriler için daha iyi
Uyumluluk Her yerde çalışır Her yerde çalışır

Yanıt Formatı

İstek biçiminden bağımsız olarak JSON yanıtlarını almak için json=1 ekleyin:

# Without json=1 — plain text response
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
})
# Response: "OK|12345678"

# With json=1 — JSON response
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})
# Response: {"status": 1, "request": "12345678"}

Daha kolay ayrıştırma için her zaman json=1 kullanın.


Python Örnekleri

Form Kodlu

import requests

# Submit
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})
task_id = resp.json()["request"]

# Poll (always GET with query params)
resp = requests.get("https://ocr.captchaai.com/res.php", params={
    "key": "YOUR_API_KEY",
    "action": "get",
    "id": task_id,
    "json": 1,
})

JSON Gövdesi

import requests

# Submit with JSON
resp = requests.post("https://ocr.captchaai.com/in.php", json={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": "SITE_KEY",
    "pageurl": "https://example.com",
    "json": 1,
})
task_id = resp.json()["request"]

# Poll (same as form-encoded — GET with params)
resp = requests.get("https://ocr.captchaai.com/res.php", params={
    "key": "YOUR_API_KEY",
    "action": "get",
    "id": task_id,
    "json": 1,
})

Node.js Örnekleri

Form Kodlu

const axios = require('axios');
const qs = require('querystring');

// Submit
const resp = await axios.post(
  'https://ocr.captchaai.com/in.php',
  qs.stringify({
    key: 'YOUR_API_KEY',
    method: 'userrecaptcha',
    googlekey: 'SITE_KEY',
    pageurl: 'https://example.com',
    json: 1,
  })
);
const taskId = resp.data.request;

JSON Gövdesi

const axios = require('axios');

// Submit with JSON
const resp = await axios.post(
  'https://ocr.captchaai.com/in.php',
  {
    key: 'YOUR_API_KEY',
    method: 'userrecaptcha',
    googlekey: 'SITE_KEY',
    pageurl: 'https://example.com',
    json: 1,
  }
);
const taskId = resp.data.request;

Resim CAPTCHA: Form vs JSON

Resim CAPTCHA'ları için format daha önemlidir:

Dosya Yüklemeli Form (Çok Parçalı)

# File upload — form-encoded with multipart
resp = requests.post("https://ocr.captchaai.com/in.php",
    data={
        "key": "YOUR_API_KEY",
        "method": "post",
        "json": 1,
    },
    files={
        "file": open("captcha.png", "rb"),
    },
)

Base64 ile JSON

import base64

# Base64 in JSON body
with open("captcha.png", "rb") as f:
    body = base64.b64encode(f.read()).decode()

resp = requests.post("https://ocr.captchaai.com/in.php", json={
    "key": "YOUR_API_KEY",
    "method": "base64",
    "body": body,
    "json": 1,
})

Base64 ile Form

# Base64 in form data
resp = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": "YOUR_API_KEY",
    "method": "base64",
    "body": body,
    "json": 1,
})

Hangisi Ne Zaman Kullanılmalı

Senaryo Önerilen neden
Basit komut dosyaları Form kodlu Daha basit, daha az bağımlılık
REST API entegrasyonu JSON Tipik API modelleriyle eşleşir
Dosya yüklemeleri Çok parçalı form Doğrudan ikili yükleme
Büyük taban64 görsel Form kodlu Büyük yüklerin daha iyi taşınması
TypeScript/modern JS JSON Yerel nesne desteği
Eski sistem entegrasyonu Form kodlu Evrensel uyumluluk
2Captcha'dan geçiş Form kodlu 2Captcha ile aynı format

Yaygın Hatalar

hata Sorun Düzeltme
json={} kullanılıyor ancak verilerde json: 1 yok Yanıt düz metindir "json": 1'yi verilere dahil edin
Python isteklerinde data= ve json='yi karıştırma İstek hatalı biçimlendirilmiş Birini veya diğerini kullanın
Content-Type başlığını unutmak Sunucu gövdeyi ayrıştıramıyor HTTP kitaplığınızın bunu otomatik olarak ayarlamasına izin verin
JSON gövdesi yoklama uç noktasına gönderiliyor Anket GET parametrelerini kullanıyor GET'i her zaman /res.php için sorgu parametreleriyle birlikte kullanın

SSS

Format, çözüm hızını veya doğruluğunu etkiler mi?

Hayır. Her iki format da aynı sonuçları üretir. Sunucu bunları aynı şekilde işler.

Aynı projede formatları karıştırabilir miyim?

Evet. JSON ile gönderebilir ve sorgu parametreleriyle anket yapabilirsiniz (yoklama her zaman bu şekilde çalışır). Her istek bağımsızdır.

2Captcha uyumlu API tarafından hangi format kullanılıyor?

Orijinal 2Captcha API'si form kodlu olanı kullanır. CaptchaAI en üste JSON desteğini ekler. 2Captcha'dan geçiş yapıyorsanız form kodlu olanı tercih edin.


İlgili Kılavuzlar


Tercih ettiğiniz formatı seçin —CaptchaAI API'yi deneyinBugün.

Bu makale için yorumlar devre dışı bırakılmıştır.