Why am I sometimes not getting a response with 2captcha API?
up vote
0
down vote
favorite
I am trying to solve recaptcha V2
with API 2captcha
,
I am using this code:
<?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();}
?>
Why am I sometimes not getting a response?
I am trying to make condition with a timeout here.
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, false, $ctx);
Then I want to loop all the code every 2 min 30 secs.
How can I use condition with file_get_contents()
?
How to do loop the code every 2 min 30 secs?
php recaptcha file-get-contents
|
show 3 more comments
up vote
0
down vote
favorite
I am trying to solve recaptcha V2
with API 2captcha
,
I am using this code:
<?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();}
?>
Why am I sometimes not getting a response?
I am trying to make condition with a timeout here.
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, false, $ctx);
Then I want to loop all the code every 2 min 30 secs.
How can I use condition with file_get_contents()
?
How to do loop the code every 2 min 30 secs?
php recaptcha file-get-contents
help you hack captcha ... NOPE.
– IdontDownVote
Nov 8 at 22:25
@IdontDownVote this is not hack , i am using 2captcha service to slove my targeted captcha .
– Ben Ammar Amine
Nov 8 at 22:28
@Ben Ammar Amine what is "slove"? This term I have not heard before...
– bcperth
Nov 9 at 2:40
@bcperth i used this term beceause it used on 2captcha service , they slove cpatcha's , they are using worker's online google it .
– Ben Ammar Amine
Nov 9 at 12:54
Ah you meant "solve" right? I thought was some new technical term :-)
– bcperth
Nov 9 at 21:44
|
show 3 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to solve recaptcha V2
with API 2captcha
,
I am using this code:
<?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();}
?>
Why am I sometimes not getting a response?
I am trying to make condition with a timeout here.
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, false, $ctx);
Then I want to loop all the code every 2 min 30 secs.
How can I use condition with file_get_contents()
?
How to do loop the code every 2 min 30 secs?
php recaptcha file-get-contents
I am trying to solve recaptcha V2
with API 2captcha
,
I am using this code:
<?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();}
?>
Why am I sometimes not getting a response?
I am trying to make condition with a timeout here.
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, false, $ctx);
Then I want to loop all the code every 2 min 30 secs.
How can I use condition with file_get_contents()
?
How to do loop the code every 2 min 30 secs?
php recaptcha file-get-contents
php recaptcha file-get-contents
edited Nov 10 at 4:17
rlandster
2,94493969
2,94493969
asked Nov 8 at 22:23
Ben Ammar Amine
114
114
help you hack captcha ... NOPE.
– IdontDownVote
Nov 8 at 22:25
@IdontDownVote this is not hack , i am using 2captcha service to slove my targeted captcha .
– Ben Ammar Amine
Nov 8 at 22:28
@Ben Ammar Amine what is "slove"? This term I have not heard before...
– bcperth
Nov 9 at 2:40
@bcperth i used this term beceause it used on 2captcha service , they slove cpatcha's , they are using worker's online google it .
– Ben Ammar Amine
Nov 9 at 12:54
Ah you meant "solve" right? I thought was some new technical term :-)
– bcperth
Nov 9 at 21:44
|
show 3 more comments
help you hack captcha ... NOPE.
– IdontDownVote
Nov 8 at 22:25
@IdontDownVote this is not hack , i am using 2captcha service to slove my targeted captcha .
– Ben Ammar Amine
Nov 8 at 22:28
@Ben Ammar Amine what is "slove"? This term I have not heard before...
– bcperth
Nov 9 at 2:40
@bcperth i used this term beceause it used on 2captcha service , they slove cpatcha's , they are using worker's online google it .
– Ben Ammar Amine
Nov 9 at 12:54
Ah you meant "solve" right? I thought was some new technical term :-)
– bcperth
Nov 9 at 21:44
help you hack captcha ... NOPE.
– IdontDownVote
Nov 8 at 22:25
help you hack captcha ... NOPE.
– IdontDownVote
Nov 8 at 22:25
@IdontDownVote this is not hack , i am using 2captcha service to slove my targeted captcha .
– Ben Ammar Amine
Nov 8 at 22:28
@IdontDownVote this is not hack , i am using 2captcha service to slove my targeted captcha .
– Ben Ammar Amine
Nov 8 at 22:28
@Ben Ammar Amine what is "slove"? This term I have not heard before...
– bcperth
Nov 9 at 2:40
@Ben Ammar Amine what is "slove"? This term I have not heard before...
– bcperth
Nov 9 at 2:40
@bcperth i used this term beceause it used on 2captcha service , they slove cpatcha's , they are using worker's online google it .
– Ben Ammar Amine
Nov 9 at 12:54
@bcperth i used this term beceause it used on 2captcha service , they slove cpatcha's , they are using worker's online google it .
– Ben Ammar Amine
Nov 9 at 12:54
Ah you meant "solve" right? I thought was some new technical term :-)
– bcperth
Nov 9 at 21:44
Ah you meant "solve" right? I thought was some new technical term :-)
– bcperth
Nov 9 at 21:44
|
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
This is my solution ,
2captcha
take about 5 second and 100 second to solve captcha's
.
In my last code the error was in sleep(23);
<?php
echo 'Starting Get Token....<br/>';
echo date("Y:m:d g:i:s");
$apiKey = "MY API KEY";
$googleKey = "6LfBixYUAAAAABhdHynFUIMA_sa4s-XsJvnjtgB0";
$pageUrl = "https://example.com";
$time = time();
while ( true ) {
$ctx=stream_context_create(array('http'=>
array(
'timeout' => 20 // 30 sec
)
));
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, FALSE,$ctx);
var_dump($retrieve);
if (empty($retrieve))
{
$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(107);
$getting = file_get_contents($con);
$second = array($getting);
$secondresult = explode('OK|',$second[0]);
$x = $secondresult[1];
echo $x;
echo'<br/>';
echo'<br/>';
if (!empty($x)) {
echo 'Task Finished ... <br/>';
echo date("Y:m:d g:i:s");
file_put_contents( 'token.txt', $x );
sleep(120);
}
}
?>
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
This is my solution ,
2captcha
take about 5 second and 100 second to solve captcha's
.
In my last code the error was in sleep(23);
<?php
echo 'Starting Get Token....<br/>';
echo date("Y:m:d g:i:s");
$apiKey = "MY API KEY";
$googleKey = "6LfBixYUAAAAABhdHynFUIMA_sa4s-XsJvnjtgB0";
$pageUrl = "https://example.com";
$time = time();
while ( true ) {
$ctx=stream_context_create(array('http'=>
array(
'timeout' => 20 // 30 sec
)
));
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, FALSE,$ctx);
var_dump($retrieve);
if (empty($retrieve))
{
$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(107);
$getting = file_get_contents($con);
$second = array($getting);
$secondresult = explode('OK|',$second[0]);
$x = $secondresult[1];
echo $x;
echo'<br/>';
echo'<br/>';
if (!empty($x)) {
echo 'Task Finished ... <br/>';
echo date("Y:m:d g:i:s");
file_put_contents( 'token.txt', $x );
sleep(120);
}
}
?>
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
add a comment |
up vote
1
down vote
accepted
This is my solution ,
2captcha
take about 5 second and 100 second to solve captcha's
.
In my last code the error was in sleep(23);
<?php
echo 'Starting Get Token....<br/>';
echo date("Y:m:d g:i:s");
$apiKey = "MY API KEY";
$googleKey = "6LfBixYUAAAAABhdHynFUIMA_sa4s-XsJvnjtgB0";
$pageUrl = "https://example.com";
$time = time();
while ( true ) {
$ctx=stream_context_create(array('http'=>
array(
'timeout' => 20 // 30 sec
)
));
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, FALSE,$ctx);
var_dump($retrieve);
if (empty($retrieve))
{
$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(107);
$getting = file_get_contents($con);
$second = array($getting);
$secondresult = explode('OK|',$second[0]);
$x = $secondresult[1];
echo $x;
echo'<br/>';
echo'<br/>';
if (!empty($x)) {
echo 'Task Finished ... <br/>';
echo date("Y:m:d g:i:s");
file_put_contents( 'token.txt', $x );
sleep(120);
}
}
?>
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
This is my solution ,
2captcha
take about 5 second and 100 second to solve captcha's
.
In my last code the error was in sleep(23);
<?php
echo 'Starting Get Token....<br/>';
echo date("Y:m:d g:i:s");
$apiKey = "MY API KEY";
$googleKey = "6LfBixYUAAAAABhdHynFUIMA_sa4s-XsJvnjtgB0";
$pageUrl = "https://example.com";
$time = time();
while ( true ) {
$ctx=stream_context_create(array('http'=>
array(
'timeout' => 20 // 30 sec
)
));
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, FALSE,$ctx);
var_dump($retrieve);
if (empty($retrieve))
{
$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(107);
$getting = file_get_contents($con);
$second = array($getting);
$secondresult = explode('OK|',$second[0]);
$x = $secondresult[1];
echo $x;
echo'<br/>';
echo'<br/>';
if (!empty($x)) {
echo 'Task Finished ... <br/>';
echo date("Y:m:d g:i:s");
file_put_contents( 'token.txt', $x );
sleep(120);
}
}
?>
This is my solution ,
2captcha
take about 5 second and 100 second to solve captcha's
.
In my last code the error was in sleep(23);
<?php
echo 'Starting Get Token....<br/>';
echo date("Y:m:d g:i:s");
$apiKey = "MY API KEY";
$googleKey = "6LfBixYUAAAAABhdHynFUIMA_sa4s-XsJvnjtgB0";
$pageUrl = "https://example.com";
$time = time();
while ( true ) {
$ctx=stream_context_create(array('http'=>
array(
'timeout' => 20 // 30 sec
)
));
$retrieve= file_get_contents("http://2captcha.com/in.php?key=".$apiKey."&method=userrecaptcha&googlekey=".$googleKey."&pageurl=".$pageUrl, FALSE,$ctx);
var_dump($retrieve);
if (empty($retrieve))
{
$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(107);
$getting = file_get_contents($con);
$second = array($getting);
$secondresult = explode('OK|',$second[0]);
$x = $secondresult[1];
echo $x;
echo'<br/>';
echo'<br/>';
if (!empty($x)) {
echo 'Task Finished ... <br/>';
echo date("Y:m:d g:i:s");
file_put_contents( 'token.txt', $x );
sleep(120);
}
}
?>
edited Nov 11 at 0:53
bcperth
2,0021514
2,0021514
answered Nov 10 at 0:58
Ben Ammar Amine
114
114
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
add a comment |
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
ok great! Maybe try to indent your code nicely in the reply?
– bcperth
Nov 10 at 1:06
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
@bcperth , i am very newbie in coding this why i am coding a horriblle code :)
– Ben Ammar Amine
Nov 10 at 12:01
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
I fixed it up for you, But read this codehs.gitbooks.io/introcs/content/Programming-with-Karel/… and this meta.stackoverflow.com/questions/300123/…
– bcperth
Nov 10 at 21:48
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
@bcperth Thank you So match .... :-)
– Ben Ammar Amine
Nov 10 at 22:13
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53217067%2fwhy-am-i-sometimes-not-getting-a-response-with-2captcha-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
help you hack captcha ... NOPE.
– IdontDownVote
Nov 8 at 22:25
@IdontDownVote this is not hack , i am using 2captcha service to slove my targeted captcha .
– Ben Ammar Amine
Nov 8 at 22:28
@Ben Ammar Amine what is "slove"? This term I have not heard before...
– bcperth
Nov 9 at 2:40
@bcperth i used this term beceause it used on 2captcha service , they slove cpatcha's , they are using worker's online google it .
– Ben Ammar Amine
Nov 9 at 12:54
Ah you meant "solve" right? I thought was some new technical term :-)
– bcperth
Nov 9 at 21:44