13 thoughts on “Create custom reCAPTCHA images using their API

  1. A lot of this logic, including the ability to display custom themes, is encapsulated in the Services_ReCaptcha PEAR package.

    • Hi Michael,

      ever thought about that this kind of comments are spam too?
      You promote PEAR, even if it’s a free product 😉

  2. Olaf,

    Sorry, I forgot you’re not a fan of PEAR :)

    Your tutorial is well written and is helpful for people to learn how to integrate with reCAPTCHA.

    My reason for mentioning Services_ReCaptcha is not to take away from the educational aspects of your post, but to let people know a well written packaged solution also exists.

    Cheers, and happy coding!

    • Your tutorial is well written and is helpful for people to learn how to integrate with reCAPTCHA.

      The reason for this tutorial is to show how stuff works PLUS how-to create a custom challenge for your form using jQuery and the jQuery form plugin.
      I’m sure there are many scripts for creating and validating a reCAPTCHA challenge, but do the work slightly together with jQuery like in this tutorial? I don’t think so…

  3. Thanks man! easy to follow.

  4. This is weird. The ReCaptcha documentation says to put recaptcha_image inside recaptcha_widget, and to give recaptcha_widget as the value of the option custom_theme_widget. However, just have recaptcha_image by itself, and instead pass that as the div argument to Recaptcha.create(). Is that legit?

    • Hello Bob,

      I took some example code and put that code together with jQuery contact form plugin :)
      I’m the example code from here on several websites (try the contact form on my company site finalwebsites.nl)
      Anyway do you have any problems with this code? Since I’m using the reCaptcha image on dutch language websites I think the challenges are very hard, even if use “nl” as localization parameter.

  5. Hello,

    I followed exactly your steps as described, the captcha work, but when i submit the form, even if i put wrong code or nothing and i click submit, the form gets submited, im using it to secure a link (URL).

    If you can be of any help please …

    • Hi,
      do you tried the example code?

      (I removed your code because it wasn’t stored by 100% by wordpress)

  6. Hi,

    In my case if i put wrong code or nothing it won’t submit so this is working fine for me but when i submit with proper code it says
    Fatal error: Call to undefined function curl_init()on recaptcha.php line 9

    this is the line it refers to

    $ch = curl_init(“http://api-verify.recaptcha.net/verify”);

    and the rest of it is

    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    $response = explode(PHP_EOL, $data);
    if ($response[0] == ‘true’) {
    echo ‘Success, you may proceed!’;
    } else {
    echo ‘Error, please try again.’;
    // check the API documentation for detailed error reports

    Hope you can help me please


    • Hello Angela,

      you need to install cURL on your web server. Ask your hosting provider to do that for you, it’s a very common library.

  7. thanks olaf ^^

    • you’re welcome Angela :)

Comments are closed.