File: /var/www/ilya/data/www/povoleni.ru/modules/services/test2.php
<?
/*require(__DIR__ . '/../../includes/2captcha/autoloader.php');
$solver = new \TwoCaptcha\TwoCaptcha('fbf23ff04b4e373bca3cbd4de2c623db');
try {
$result = $solver->recaptcha([
'sitekey' => '6LfDkwskAAAAAJkuXNNbQPBcNfD4V7nQHbg68ptU',
'url' => 'https://frs.gov.cz/informace-o-stavu-rizeni/?',
'version' => 'v3',
'action' => 'proceedings',
'proxy' => [
'type' => 'HTTPS',
'uri' => $proxyauth.'@'.$proxy,
],
]);
} catch (\Exception $e) {
die($e->getMessage());
}
//die('Captcha solved: ' . $result->code);*/
/////////////////////////////////////
function check_application($code,$type,$year,$zov) {
/* {
"identification" : "OAM-21080/DP-2023",
"state" : "INPROGRESS"
}
{
"timestamp" : "2023-08-05T13:22:27.126823",
"status" : 400,
"code" : "NO_CODE",
"path" : "POST /api/ip/external/proceedings/state/cj/zov?idCj=21080&database=DP&year=2023&zov=",
"message" : "reCaptcha was not successfully validated"
} */
$proxy_data = mysqli_fetch_array(query("SELECT * FROM `proxy_list` ORDER BY RAND() LIMIT 1"));
$proxy = $proxy_data['host'];
$proxyauth = $proxy_data['auth'];
//$proxy = 'proxy.packetstream.io:31112';
//$proxyauth = 'rudomilov:5hW98vnvJ8W9sU5U_session-LrbIAgdB';
require(__DIR__ . '/../../includes/bestcaptchasolver.php'); // load API library
$ACCESS_TOKEN = '4D0FF5D715954021868C12C09DB89552';
$PAGE_URL = 'https://frs.gov.cz/informace-o-stavu-rizeni/?';
$SITE_KEY = '6LfDkwskAAAAAJkuXNNbQPBcNfD4V7nQHbg68ptU';
$bcs = new BestCaptchaSolver($ACCESS_TOKEN); // get token from https://bestcaptchasolver.com/account
// check account balance
$balance = $bcs->account_balance(); // get balance
//echo "Balance: $balance";
//echo ' Submitting recaptcha...';
$p = array();
$p['page_url'] = $PAGE_URL;
$p['site_key'] = $SITE_KEY;
// other parameters
// ----------------------------------------------------------------------
// reCAPTCHA type(s) - optional, defaults to 1
// ---------------------------------------------
// 1 - v2
// 2 - invisible
// 3 - v3
// 4 - enterprise v2
// 5 - enterprise v3
//
$p["type"] = "3";
//
$p["v3_action"] = "proceedings"; // action used when solving v3 reCaptcha, optional
//$p["v3_min_score"] = "0.3"; // min score to target when solving v3, optional
//$p['domain'] = "www.google.com"; // used in loading reCAPTCHA, in some cases it works better with - recaptcha.net
//$p["data_s"] = "recaptcha data-s parameter used in loading reCAPTCHA"; // optional
//$p["cookie_input"] = "a=b;c=d"; // used in solving of reCAPTCHA, optional
//$p['user_agent'] = 'user agent here'; // optional
$p["proxy"] = $proxyauth.'@'.$proxy; // proxy with/out authentication, optional
//$p["affiliate_id"] = "affiliate_id"; // get it from /account, optional
$id = $bcs->submit_recaptcha($p);
// get response now that we have the ID
$gresponse = NULL;
while($gresponse === NULL) {
$gresponse = $bcs->retrieve($id)['gresponse']; // get the image text (if completed)
$proxy_status = $bcs->retrieve($id)['proxy_status'];
sleep(5); // retry every 5 seconds
}
// completed at this point
echo " Recaptcha response: $gresponse";
// $proxy_status = $bcs->retrieve($id)['proxy_status'];
// $bcs->set_captcha_bad($id); // set bad captcha for specific id
/////////////////////
$url = 'https://frs.gov.cz/informace-o-stavu-rizeni/';
$additional_headers = array(
'Accept: */*'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $additional_headers);
curl_setopt ($ch, CURLOPT_PROXY, $proxy);
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
$server_output = curl_exec ($ch);
//echo "<b>".$server_output."</b>";
curl_close($ch);
sleep(rand(4,8));
/////////////////////
$url = 'https://frs.gov.cz/api/ip/external/proceedings/state/cj/zov?idCj='.$code.'&database='.$type.'&year='.$year.'&zov='.$zov;
print "Key: ".$gresponse."\nProxy: ".$proxy_status."\n";
$data = '{ "captcha": "'.$gresponse.'" }';
$additional_headers = array(
'Accept: application/json',
'Content-Type: application/json'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $additional_headers);
curl_setopt ($ch, CURLOPT_PROXY, $proxy);
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
$server_output = curl_exec ($ch);
echo "<b>".$server_output."</b>";
curl_close($ch);
$parsed_output = json_decode($server_output);
if(array_key_exists('message',$parsed_output))
if($parsed_output->{'message'}=='reCaptcha was not successfully validated') {
//$bcs->set_captcha_bad($id);
query("UPDATE `proxy_list` SET `last_used`=NOW(), `attempts_failed`=`attempts_failed`+1 WHERE `id`='".$proxy_data['id']."' LIMIT 1;");
die($parsed_output->{'message'});
}
query("UPDATE `proxy_list` SET `last_used`=NOW(), `attempts_success`=`attempts_success`+1 WHERE `id`='".$proxy_data['id']."' LIMIT 1;");
return $parsed_output;
}
$result = check_application('53358','ZM','2023','');
print $result->{'identification'}.': '.$result->{'state'};
?>