<?php
// captchatototext.php - Solve CAPTCHA using dhboss.com
// API Key for dhboss.com CAPTCHA solving
$apiKey = "aApRPDI3jpSMKrcoxw5BHj6PLlDfi9TxcqQOMPWseeMmalpySarFdif3jVQfmLCYlsbGnv";

function solveCaptcha($captchaBase64, $apiKey) {
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
        CURLOPT_URL => base64_decode('aHR0cHM6Ly9hcGkuZGhib3NzLmNvbS9hcGljYWxsL2NhcHRjaGFfaW1hZ2VfdG9fdGV4dC8='),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => 'apikeyfill=' . $apiKey . '&image_url=' . urlencode($captchaBase64),
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
    ));
    
    $response = curl_exec($curl);
    $error = curl_error($curl);
    curl_close($curl);
    
    if ($error) {
        return ['error' => $error];
    }
    
    return json_decode($response, true);
}
?>