// https://github.com/2captcha/2captcha-csharp
using System;
using System.Linq;
using TwoCaptcha.Captcha;
namespace TwoCaptcha.Examples
{
public class KeyCaptchaExample
{
public void Main()
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
KeyCaptcha captcha = new KeyCaptcha();
captcha.SetUserId(184015);
captcha.SetSessionId("5f31a2bc933d3-4.0.0.001");
captcha.SetWebServerSign("9006dc725760858e4c0715b835472f22");
captcha.SetWebServerSign2("2ca3abe86d90c6142d5571db98af6714");
captcha.SetUrl("https://2captcha.com/demo/keycaptcha");
try
{
solver.Solve(captcha).Wait();
Console.WriteLine("Captcha solved: " + captcha.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
// https://github.com/2captcha/2captcha-java
package examples;
import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.KeyCaptcha;
public class KeyCaptchaExample {
public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
KeyCaptcha captcha = new KeyCaptcha();
captcha.setUserId(184015);
captcha.setSessionId("5f31a2bc933d3-4.0.0.001");
captcha.setWebServerSign("9006dc725760858e4c0715b835472f22");
captcha.setWebServerSign2("2ca3abe86d90c6142d5571db98af6714");
captcha.setUrl("https://2captcha.com/demo/keycaptcha");
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
}
// https://github.com/2captcha/2captcha-php
require(__DIR__ . '/../src/autoloader.php');
$solver = new \TwoCaptcha\TwoCaptcha('YOUR_API_KEY');
try {
$result = $solver->keycaptcha([
's_s_c_user_id' => 184015,
's_s_c_session_id' => '5f31a2bc933d3-4.0.0.001',
's_s_c_web_server_sign' => '9006dc725760858e4c0715b835472f22-pz-',
's_s_c_web_server_sign2' => '2ca3abe86d90c6142d5571db98af6714',
'url' => 'https://2captcha.com/demo/keycaptcha',
]);
} catch (\Exception $e) {
die($e->getMessage());
}
die('Captcha solved: ' . $result->code);
# https://github.com/2captcha/2captcha-python
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from twocaptcha import TwoCaptcha
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
solver = TwoCaptcha(api_key)
try:
result = solver.keycaptcha(
s_s_c_user_id=184015,
s_s_c_session_id='5f31a2bc933d3-4.0.0.001',
s_s_c_web_server_sign='4f84e4fe41cf688d8d94361489ecd75c-pz-',
s_s_c_web_server_sign2='a9af97bb0a645eec495f2527e431a21b',
url='https://2captcha.com/demo/keycaptcha')
except Exception as e:
sys.exit(e)
else:
sys.exit('solved: ' + str(result))