<html>
<body>
<form action="" method="post">
<?php
require_once('recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "...my publickey...";
$privatekey = "...my privatekey...";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br>
<input type="submit" value="submit" />
</form>
</body>
</html>
On 30 Mai, 08:43, "reCAPTCHA Support" <supp...@recaptcha.net> wrote:
> Could you please post the code you are using? Otherwise, it won't be
> possible to debug
>
I have just encountered this problem too. I think its our DNS. Try
replacing
$recaptcha_verify_server = 'api-verify.recaptcha.net';
with
$recaptcha_verify_server = '128.2.186.116';
in recaptchalib.php. It works for me.
Note that the first time I did this my public private keys seemed to
become invalid ... I know its a stupid thing to say, but that is
literally the only change I made on my whole machine and the keys were
no longer accepted and I had to generate new ones. I find that very
disconcerting.
Let me know if you figure out how to get the name resolution working.
On May 30, 7:03 am, braunbaer <gebh...@blankedv.at> wrote:
> Hi,
> I am testing reCAPTCHA on my Website:www.blankedv.at/check
> After continue i see a message: "could not open socket".
> Please help.
> thanks
> Gebhard
I have just encountered this problem too. I think its our DNS. Try
replacing
$recaptcha_verify_server = 'api-verify.recaptcha.net';
with
$recaptcha_verify_server = '128.2.186.116';
in recaptchalib.php. It works for me.
Note that the first time I did this my public private keys seemed to
become invalid ... I know its a stupid thing to say, but that is
literally the only change I made on my whole machine and the keys were
no longer accepted and I had to generate new ones. I find that very
disconcerting.
On Jun 2, 10:20 pm, "reCAPTCHA Support" <supp...@recaptcha.net> wrote:
> Hello,
>
> On 6/2/07, Pietro <pietro...@gmail.com> wrote:
>
> > On May 30, 7:03 am, braunbaer <gebh...@blankedv.at> wrote:
> > > Hi,
> > > I am testing reCAPTCHA on my Website:www.blankedv.at/check
> > > After continue i see a message: "could not open socket".
> > > Please help.
> > > thanks
> > > Gebhard
>
> > I have just encountered this problem too. I think its our DNS. Try
> > replacing
>
> > $recaptcha_verify_server = 'api-verify.recaptcha.net';
> > with
> > $recaptcha_verify_server = '128.2.186.116';
>
> This solution has the potential to break. reCAPTCHA runs in multiple data
> centers so that we can have 100% uptime. A critical part of this is that we
> change DNS when a data center goes down (or in advance when there is
> scheduled downtime). Doing this change is at your own risk.
>
Hi.
Yeah, I figured it wasnt safe. Its just a temporary solution until I
figure out the real problem.
> Can you run:
>
> host api-verify.recaptcha.net
>
> from your server? Also try running
>
> dig +trace api-verify.recaptcha.net
>
> in recaptchalib.php. It works for me.
>
Is hostx the same thing?
# hostx api-verify.recaptcha.net
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
Im sorry but I dont understand where you want me to run that dig
command from ... I dont have a "dig" installed and dont know what
package it might be in ...
>
> > Note that the first time I did this my public private keys seemed to
> > become invalid ... I know its a stupid thing to say, but that is
> > literally the only change I made on my whole machine and the keys were
> > no longer accepted and I had to generate new ones. I find that very
> > disconcerting.
>
> Invalid how? What error message did you get?
My keys have stopped working again this morning. I am developing a
site locally. I have a virtual site under Apache and an entry in my
hosts file which directs my phony URL to localhost. When I tried using
keys generated with "localhost" they didnt work so I have used
"127.0.0.1". The error message I am seeing this morning is:
reCAPTCHA: Domain not authorized for key. [help]
Presumably if I generate new keys for 127.0.0.1 they will work (it did
last night). As I said, this was working fine when I shutdown last
night. The only thing I can think of is that my broadband connections
IP keeps changing, but I really dont think thats likely.
> Most likely, you accessed the website via a different host (eg, registered a
> key for localhost, used localhost for testing, then tried foo.bar.com). Keep
> in mind that keys are tied to hosts (as validated via the referrer header).
> Doing this enhances security.
>
> --
> reCAPTCHA: stop spam, read bookshttp://recaptcha.net
Its good that you provide this level of support. Thanks.
On Jun 2, 10:20 pm, "reCAPTCHA Support" <supp...@recaptcha.net> wrote:
> Hello,
>
> On 6/2/07, Pietro <pietro...@gmail.com> wrote:
>
> > On May 30, 7:03 am, braunbaer <gebh...@blankedv.at> wrote:
> > > Hi,
> > > I am testing reCAPTCHA on my Website:www.blankedv.at/check
> > > After continue i see a message: "could not open socket".
> > > Please help.
> > > thanks
> > > Gebhard
>
> > I have just encountered this problem too. I think its our DNS. Try
> > replacing
>
> > $recaptcha_verify_server = 'api-verify.recaptcha.net';
> > with
> > $recaptcha_verify_server = '128.2.186.116';
>
> This solution has the potential to break. reCAPTCHA runs in multiple data
> centers so that we can have 100% uptime. A critical part of this is that we
> change DNS when a data center goes down (or in advance when there is
> scheduled downtime). Doing this change is at your own risk.
>
Hi.
Yeah, I figured it wasnt safe. Its just a temporary solution until I
figure out the real problem.
> Can you run:
>
> host api-verify.recaptcha.net
>
> from your server? Also try running
>
> dig +trace api-verify.recaptcha.net
>
> in recaptchalib.php. It works for me.
>
Is hostx the same thing?
# hostx api-verify.recaptcha.net
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
api-verify.recaptcha.net A 128.2.186.116
Im sorry but I dont understand where you want me to run that dig
command from ... I dont have a "dig" installed and dont know what
package it might be in ...
>
> > Note that the first time I did this my public private keys seemed to
> > become invalid ... I know its a stupid thing to say, but that is
> > literally the only change I made on my whole machine and the keys were
> > no longer accepted and I had to generate new ones. I find that very
> > disconcerting.
>
> Invalid how? What error message did you get?
My keys have stopped working again this morning. I am developing a
site locally. I have a virtual site under Apache and an entry in my
hosts file which directs my phony URL to localhost. When I tried using
keys generated with "localhost" they didnt work so I have used
"127.0.0.1". The error message I am seeing this morning is:
reCAPTCHA: Domain not authorized for key. [help]
Presumably if I generate new keys for 127.0.0.1 they will work (it did
last night). As I said, this was working fine when I shutdown last
night. The only thing I can think of is that my broadband connections
IP keeps changing, but I really dont think thats likely.
> Most likely, you accessed the website via a different host (eg, registered a
> key for localhost, used localhost for testing, then tried foo.bar.com). Keep
> in mind that keys are tied to hosts (as validated via the referrer header).
> Doing this enhances security.
>
> --
?
$fs = fsockopen($host, $port, $errno, $errstr, 30);
stream_set_blocking($fs, 0);
if (!$fs) {
die( "Now using blocking: $errstr ($errno)<br />\n");
}
I get back
Warning: fsockopen() [function.fsockopen]: unable to connect to api-
verify.recaptcha.net:80
Warning: stream_set_blocking(): supplied argument is not a valid
stream resource
Now using blocking: Host is down (64)
hope this helps find an answer.
-D
On Jun 7, 12:06 am, "reCAPTCHA Support" <supp...@recaptcha.net> wrote:
> Just an idea: are you using some RedHat based system where selinux is taking
> affect? Do you have some sort of firewall?
>
> On 6/6/07, Dai <dai.sweng...@gmail.com> wrote:
>
>
>
>
>
> > Same issue. However I edited the $response in the recaptchalib.php
> > $response = '';
> > /* if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr,
> > 10) ) ) {
> > die ('Could not open socket');
> > }
> > */
>
> > $fs = fsockopen($host, $port, $errno, $errstr, 30);
> > stream_set_blocking($fs, 0);
> > if (!$fs) {
> > die( "Now using blocking: $errstr ($errno)<br />\n");
> > }
>
> > I get back
>
> > Warning: fsockopen() [function.fsockopen]: unable to connect to api-
> > verify.recaptcha.net:80
>
> > Warning: stream_set_blocking(): supplied argument is not a valid
> > stream resource
> > Now using blocking: Host is down (64)
>
> > hope this helps find an answer.
>
I had the same problem just now. The quickest solution is to replace
the use of globals ($recaptcha_api_server,
$recaptcha_api_secure_server and $recaptcha_verify_server) with
constants.
so, what's the solution for this "Socket" problem???
I dunno why, but if I activate the reCAPTCHA on my blog (I'm using
wordpress), then I can't receive any comments....
It will come to "Could not open socket"
So, for now I just deactivate this reCAPTCHA so that I can receive the
comments, but then again there are many "tramadols" (SPAM) come to my
blog.. (>_<)
Anyone can help?
so, what should I replace (write) on recaptchalib.php ?
I just change the word "global" with "constants" ???
** sorry I'm a beginner in this kind of thing (^_^) **
On Jul 27, 9:51 am, "reCAPTCHA Support" <supp...@recaptcha.net> wrote:
> One person said:
>
> The quickest solution is to replace
>
> > the use of globals ($recaptcha_api_server,
> > $recaptcha_api_secure_server and $recaptcha_verify_server) with
> > constants.
>
> On 7/26/07, Ooze <ivan.kurnia...@gmail.com> wrote:
>
>
>
>
>
>
>
> > YOOOOOOOW.....
>
> > so, what's the solution for this "Socket" problem???
>
> > I dunno why, but if I activate the reCAPTCHA on my blog (I'm using
> > wordpress), then I can't receive any comments....
> > It will come to "Could not open socket"
>
> > So, for now I just deactivate this reCAPTCHA so that I can receive the
> > comments, but then again there are many "tramadols" (SPAM) come to my
> > blog.. (>_<)
>
> > Anyone can help?
>
> > On Jul 25, 6:44 am, proteus <sebastian.avarva...@gmail.com> wrote:
> > > Just in case someone else stumbles across a similar problem, note that
> > > you will get the same error if globals are disabled on your server.
>
> > > I had the same problem just now. The quickest solution is to replace
> > > the use of globals ($recaptcha_api_server,
> > > $recaptcha_api_secure_server and $recaptcha_verify_server) with
> > > constants.
>
> --
> reCAPTCHA: stop spam, read bookshttp://recaptcha.net- Hide quoted text -
>
> - Show quoted text -
I encountered a problem with the recaptchalib.php when trying to
install it on my website running on a php 5 configuration. It appears
that the problem came from the global variables. No idea, if it comes
from my specific configuration but anyway. I replaced the global
coinfig variables by constants which make the script run without any
problems since that. I think it could be better to do such a
replacement on the 'official' script. What do you think about it ?
My modifications are below :
// at the beginning of the file, suppress vars
//and define constants
define('RECAPTCHA_API_SERVER',' http://api.recaptcha.net');
define('RECAPTCHA_API_SECURE_SERVER','https://api-
secure.recaptcha.net');
define('RECAPTCHA_VERIFY_SERVER','api-verify.recaptcha.net ');
//suppress "global" declarations
//replace
$recaptcha_api_server
// by the constant
RECAPTCHA_API_SERVER
Hope this helps
Is it possible that you were calling recaptchalib inside a function
and that therefore the globals weren't visible?
--
Andy Armstrong, hexten.net