"fail opening recaptchalib.php"

1,409 views
Skip to first unread message

Albert

unread,
Jan 13, 2012, 2:04:14 PM1/13/12
to reCAPTCHA
Hello,

I'm struggling with the reCAPTCHA code and I keep getting an error I
am not able to get rid of and make the form+captcha work.

The error message:

"Warning: require_once(recaptchalib.php) [function.require-once]:
failed to open stream: No such file or directory in E:\kunden\homepages
\15\d348799235\www\verify.php on line 2
Fatal error: require_once() [function.require]: Failed opening
required 'recaptchalib.php' (include_path='.;C:\php\pear') in E:\kunden
\homepages\15\d348799235\www\verify.php on line 2"

The form is in an html file and looks like this:

...
<form method="post" action="verify.php">
<label>Nombre</label><input type="text" name="nombre" />
<label>E-mail</label><input type="text" name="email" />
<label>Consulta</label><textarea rows="4" cols="6"
name="comentario"></textarea>
<?php
require_once('recaptchalib.php');
$publickey = "MYPUBLICKEY"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<input class="boton" type="submit" value="Enviar" />
</form>
...

and verify.php looks like this:

<?php
require_once('recaptchalib.php');
$privatekey = "MY PRIVATE KEY";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it
again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
$encabezado = "From: EMAILADDRESS\r\n". "MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1";
$cuerpo = "Formulario de contacto\n";
$cuerpo .= "Nombre: " . $_POST["nombre"] . "\n";
$cuerpo .= "Email: " . $_POST["email"] . "\n";
$cuerpo .= "Comentario: " . $_POST["comentario"] . "\n";

if(mail("MYEMAILADDRESS","Formulario recibido",$cuerpo,$encabezado))
echo "Gracias por contactarnos.<br/><br/> Hemos recibido su mensaje
correctamente.<br/> En breve nos pondremos en contacto con usted.<br/
><br/> Un saludo.";
else echo "Lo sentimos.<br/> Ha resultado imposible enviar el
mensaje. Vuelva a intentarlo pasados unos minutos.<br/><br/>
Gracias.";
}
?>

I'll really apreciate some help.
Thanks a lot!

Albert

Pep Sanchez

unread,
Jan 13, 2012, 2:16:30 PM1/13/12
to reca...@googlegroups.com
Intenta usar include("../recaptcha.php"); tambien puedes probar a dentro del require poner "../recaptacha.php"

ya me cuentas ese error es por que no accedes bien a las carpetas en el servidor a mi me pasaba y lo arreglo tocando eso. Saludos de Mallorca.

2012/1/13 Albert <agilm.f...@gmail.com>

Albert

--
You received this message because you are subscribed to the Google Groups "reCAPTCHA" group.
To post to this group, send email to reca...@googlegroups.com.
To unsubscribe from this group, send email to recaptcha+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/recaptcha?hl=en.


PJH

unread,
Jan 13, 2012, 4:10:17 PM1/13/12
to reca...@googlegroups.com


On Fri, Jan 13, 2012 at 7:04 PM, Albert <agilm.f...@gmail.com> wrote:
(at the top of their email, the first message from php...)
"Warning: require_once(recaptchalib.php) [function.require-once]:
failed to open stream: No such file or directory in E:\kunden\homepages
\15\d348799235\www\verify.php on line 2

Did you read this warning?
 
Did you do something about it gefore posting?
I'm guessing no.

--
PJH


ZackR

unread,
Jan 13, 2012, 4:51:24 PM1/13/12
to reCAPTCHA
Your problem is that PHP will not execute in a *.html file. It will
only execute in a *.php file. Try changing the file extension and
giving that a go.

If that doesn't do it then your other problem may be that the way you
have it set up now requires all of the files to be in the same folder.
You get the error cause PHP can't find any of the files. So make sure
that in one folder you have "verify.php" "recaptchalib.php"
"thecodefortheform.php". Make sure that you download
"recaptchalib.php" at the below link and put it all in the same folder
as well.

http://code.google.com/p/recaptcha/downloads/list?q=label:phplib-Latest


Zack
Reply all
Reply to author
Forward
0 new messages