Hi. I'm looking for a way to perfrom a recaptcha verification pass on an html form then, if successful, submit the detail to salesforce via their Web2Lead feature (don't have API access unfortunately).
Our salesforce integrated contact form has been subject to spam, like many others it seems, therefore I have incorporated recaptha to better verify the human touch. However, having altered the form action to use process.php (my working recaptcha verification script) I am now completely stumped as to how I then submit the detail to Web2Lead when the recaptcha check is successful. The only way I understand to do this is via the below form action which I have had to replace so as to enable the recaptcha check:
action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8"
Can I submit the detail from the process.php file in some way or maybe have a new hidden form populated using the original filled-out detail then have this new form auto-submitted the above code as its action?
Process.php file
<?php
session_register();
session_start();
$firstname = $_POST['first_name'] ;
$_SESSION['firstname'] = $firstname;
$lastname = $_POST['last_name'] ;
$_SESSION['lastname'] = $lastname;
$email = $_POST['email'] ;
$_SESSION['email'] = $email;
$phone = $_POST['phone'] ;
$_SESSION['phone'] = $phone;
$company = $_POST['company'] ;
$_SESSION['company'] = $company;
$URL = $_POST['URL'] ;
$_SESSION['URL'] = $URL;
$description = $_POST['description'] ;
$_SESSION['description'] = $description;
require_once('recaptchalib.php');
$privatekey = "...PRIVKEY";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
header("location:request_submitted.php?result=fail");
die();
}
else if ($resp->is_valid) {
header("location:request_submitted.php?result=pass");
}
?>
At the moment, the recaptcha is checked and you are then directed to the above header page with success or failure notifications to the user which is great !)()! (free sarcmark!). However, with no info now ending up in salesforce, my form pretty much of 'zero use to my business'. Doh!
Any help or guidance will be really appreciated. TIA