I have created a web-to-lead form and I am using the generated HTML in my site.com. I am using reCaptcha in my form.

HTML Web-to-Lead form

<form action="/recaptcha_verify.php" method="post"  name="emailForm" id="test" style="padding: 0px; margin: 0px;" >
<input type=hidden name="oid" value="00D40000000IUAQ">
<input type=hidden id="From_Link" maxlength="255" name="From_Link" value="<?=$cameFrom ?>"  /> <!-- came from link  //-->
<input type=hidden id="Campaign_ID" name="Campaign_ID" value="701400000005waD"> <!-- Google Ad Words //-->
<input type=hidden id="recordType" name="recordType" value="0124000000014Ed"> <!-- Google Ad Words //-->
<input type=hidden name="retURL" value="http://www.thankyoupage.com/merci-beaucoup">
      <td >First Name: <br />
      <input  style="width:200px;" id="first_name" maxlength="40" name="first_name" size="20" type="text"/>
      <td >Last Name: <br />
      <input  style="width:200px;" id="last_name" maxlength="80" name="last_name" size="20" type="text" />
      <td >Email:<br />
        <input  style="width:200px;" id="email" maxlength="80" name="email" size="20" type="text" /></td>

      <td >Company:<br />
      <input  style="width:200px;" id="company" maxlength="40" name="company" size="20" type="text" />
      <td >Country: <br />
        <input  style="width:200px;" id="country" maxlength="40" name="country" size="20" type="text" />
      <td >Region: <br />
<select  id="Region" name="Region" title="Region"><option value="North America">North America</option>
<option value="South America">South America</option>
<option value="EMEA">EMEA</option>
<option value="APAC">APAC</option>
      <td align="left" >
      <span class="style1 style2">Verify Code:<br />

        <br />
        <!-- Captcha//-->

echo recaptcha_get_html($publickey);

        <!-- Captcha //--></td>
    <tr><td><input type="submit" name="submit"></td>




         //Recaptcha Settings
       $publickey = "xxxx"; // you got this from the signup page
       $privatekey = "xxxx";

       if ($submit){  //if its sumbitted

        $resp = recaptcha_check_answer ($privatekey,

        $ok = 1;

            if (!$resp->is_valid) { //if captcha is  invalid
              $ok = 0;  

            if ($ok){   
               //Put here the data for sf leads storing
            else {
              // Message here that the captcha was invalid 


The problem is when I submit my form, site.com do not run PHP code instead it downloads the php file on client side. Do I need to setup my own PHP server to process this request?

Any help will be appreciated.

  • I almost downvoted this, then realized I was entirely wrong. and this is a totally a legit question. Well played. – sfdcfox Nov 22 '13 at 13:08

Salesforce.com doesn't run PHP. It runs Visualforce and Apex Code. As such, you can't just drop reCaptcha or any other PHP open source solution into place for a successful captcha service. You will probably need your own server to host the PHP so you can validate the codes. Try this Google Search for some ideas.

Top hits include:

  1. Calling reCaptcha from a remote server.
  2. Rolling your own captcha.
| improve this answer | |
  • 1
    But Site.com doesnt' support Apex. – loosy Nov 22 '13 at 15:27

In doing some research today on CAPTCHA, I discovered Adding CAPTCHA to Force.com Sites in the Technical Library on how to implement reCAPTCHA on Force.com sites when submitting forms included within VisualForce pages.

The link includes a sample VisualForce Page plus code for an Apex Controller to handle the reCAPTCHA verification, reset and other functionality.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.