I am hoping to get a quick answer to a simple problem.
I am trying to use the ReCaptcha on a site and the form is currently submitting to salesforce.com.
In the ReCaptcha instructions it tells me that the verify.php should run then submit if it passes I suppose.
Specifically like so:
<?php
require_once('recaptchalib.php');
$privatekey = "your_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 {
// Your code here to handle a successful verification
}
?>
If the original form is to submit like the following:
action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"
How would I handle this within the php script above?
Any help is appreciated!
Short answer: you can’t.
Long answer: The action isn’t controlled by you, it’s controlled by salesforce. You could perhaps make the action your verify script and then post the variables for the user but this would most likely screw up their session at salesforce. There isn’t really any practical way around that. (I mean you could try to reverse engineer / rebuild the session for the user but it’s going to likely be a lot of work to get it right and then they could change something which causes it to break)
Your best bet would be to have a separate log-in which uses ReCaptcha and then put your original form behind the login.