1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?php
function token(){
$apiKey = "MY_API_KEY";
$googleKey = "6LfBixYUAAAAABhdHynFUIMA_sa4s-XsJvnjtgB0";
$pageUrl = "https://example.com/";
$time = time();
while ( true ) {
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, false, $ctx);
$first = array($retrieve);
$result = explode('OK|',$first[0]);
$hello = $result[1];
$con="http://2captcha.com/res.php?key=".$apiKey."&action=get&id=".$hello;
sleep(23);
$getting = file_get_contents($con);
$second = array($getting);
$secondresult = explode('OK|',$second[0]);
$reponsetoken = $secondresult[1];
echo'<br/>';
echo'<br/>';
echo'get new captcha token ...';
echo'<br/>';
echo'<br/>';
if ((time() - $time) >= 99) {
echo date("Y:m:d g:i:s"), PHP_EOL;
$time = time();
}
sleep(2);
}
}
if (!empty($reponsetoken)) {
file_put_contents( 'token.txt', $reponsetoken );
}
else{token();}
?> |