function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EmanuelEmanuel 

ReCaptcha implementation with Web2Lead on success

Good Morning Ladies and Gents,

 

I am having the following issue. I have implemented a captcha widget to my downloads page since there were a log of spam files that were coming through. After hours of working on this I have finally gotten the Captcha app to work and forward after successful entry to the actual download page. 

 

However, the lead info that was inputted in the form is not being forwarded as a lead at all. My guess is that the code is missing in the verify.php file. But I am not entirely too sure. Might have taken on a bit too much of a project with this one. 

 

 
FORM.PHP
<form action="verify.php" method="POST">
<input type=hidden name="oid" value="SALESFORCE I.D.">
<input type=hidden name="retURL" value="/downloads.php">
  <label for="first_name"><br />
    <strong>(*) Fields that are required </strong><br />
    <br />
    First Name (*)</label><br />
  <input  id="first_name" maxlength="40" name="first_name" size="20" type="text" required="required" /><br>
       
  <label for="last_name">Last Name (*)</label> <br />
  <input  id="last_name" maxlength="80" name="last_name" size="20" type="text" required="required"  /><br>
        
  <label for="email">Email (*)<br />
  </label>
  <input  id="email" maxlength="80" name="email" size="20" type="text" required="required" /><br>
        
  <label for="phone">Phone <br />
  </label>
  <input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>
        
  <label for="company">Company <br />
  </label>
  <input  id="company" maxlength="40" name="company" size="20" type="text" /><br>
        
  <label for="city">City <br />
  </label>
  <input  id="city" maxlength="40" name="city" size="20" type="text" /><br>
        
  <label for="state">State/Province <br />
  </label>
  <input  id="state" maxlength="20" name="state" size="20" type="text" /><br>
        
  <label for="country">Country <br />
  </label>
  <input  id="country" maxlength="40" name="country" size="20" type="text" /><br><br>
  <strong>Interest (hold Ctrl (Windows) / Command (MacOsX) to select more than one)</strong></p>
<select  id="SALESFORCE_ID" multiple="multiple" name="SALESFOCE_NAME" title="Interest"><br>
<option value="C5">C5</option>
<option value="D5">D5</option>
<option value="Dispensing">Dispensing</option>
<option value="In-Line">In-Line</option>
<option value="M7">M7</option>
<option value="M75">M75</option>
<option value="M7 HP">M7 HP</option>
<option value="M8 Cube">M8 Cube</option>
<option value="M8">M8</option>
<option value="M85">M85</option>
<option value="M10 Pro">M10 Pro</option>
<option value="M10 Power">M10 Power</option>
<option value="ML">ML</option>
<option value="MXL">MXL</option>
</select>
<br>
<label for="lead_source"></label>
<input id="lead_source" maxlength="40" name="lead_source" size="20" option value="Web Form" type=hidden />
<?php
require_once('recaptchalib.php');
    $publickey = "PUBLIC_GOOGLE_cAPTCHA_kEY";
    echo recaptcha_get_html($publickey);
?>
<input type="submit"/>
</form><p>&nbsp;</p>

 

 

 
VERIFY.PHP
<?php
 require_once('recaptchalib.php');
 $privatekey = "GOOGLE CAPTCHA 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
   echo '<META HTTP-EQUIV="Refresh" Content="0; URL=downloads.php">';
//    header("Location: https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8");
//    $url = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
exit;
 }
 ?>

 

In the above coding the last two lines:

 

//header("Location: https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8");

// $url = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';

 

Are my guess as to where I should be pointing the forward. However, I thoroughly believe that I am missing something else as I feel as though the SF ID and user name are missing. 

 

Certain values have been replaced due to security reasons. Please let me know if you could further assist with the following to make sure that I can get this thing going as every other hour or so I am getting some spam message from China, 

 

Thank you. 

 

Emanuel. 

Amanda Byrne- Carolina Tiger RescueAmanda Byrne- Carolina Tiger Rescue
I am also trying to figure this one out.  Would love to see the answer ~ Amanda