BotDetect CAPTCHA Simple API Reference

SimpleCaptcha Class ASP.NET Version Reference

BotDetect.Web.SimpleCaptcha Class Reference
BotDetect.Web.SimpleCaptcha public method SimpleCaptcha The SimpleCaptcha constructor
BotDetect.Web.SimpleCaptcha public method bool Validate
  • string userInput
  • string captchaId
Validate the captcha using the specified user input and captchaId

Usage example:

// create a captcha instance to be used for the captcha validation 
SimpleCaptcha yourFirstCaptcha = new SimpleCaptcha(); 
// execute the captcha validation 
bool isHuman = yourFirstCaptcha.Validate(userEnteredCaptchaCode, captchaId); 

SimpleCaptcha Class Java Version Reference

com.captcha.botdetect.web.servlet.SimpleCaptcha Class Reference
BotDetect.Web.SimpleCaptcha public method SimpleCaptcha The SimpleCaptcha constructor
BotDetect.Web.SimpleCaptcha public method bool validate
  • string userInput
  • string captchaId
Validate the captcha using the specified user input and captchaId

Usage example:

// create a captcha instance to be used for the captcha validation 
SimpleCaptcha yourFirstCaptcha = SimpleCaptcha.load(request); 
// execute the captcha validation 
boolean isHuman = yourFirstCaptcha.validate(userEnteredCaptchaCode, captchaId) 

SimpleCaptcha Class PHP Version Reference

SimpleCaptcha Class Reference
BotDetect.Web.SimpleCaptcha public method SimpleCaptcha The SimpleCaptcha constructor
BotDetect.Web.SimpleCaptcha public method bool Validate
  • string userInput
  • string captchaId
Validate the captcha using the specified user input and captchaId

Usage example:

// create a captcha instance to be used for the captcha validation 
$yourFirstCaptcha = new SimpleCaptcha(); 
// execute the captcha validation 
$isHuman = $yourFirstCaptcha->Validate($userEnteredCaptchaCode, $captchaId); 

BotDetect Client-Side Object Reference

BotDetect client-side object instances expose all Captcha workflow functions and values, as well as several Captcha life-cycle events. These objects can be accessed in your client-side scripts:

  • using this.<member_name> within member functions and custom event handlers.

    E.g. if you register a function as a custom handler for the preReloadImage BotDetect event, you can access the BotDetect client-side object within that function using this.

  • using <captchaStyleName>.<member_name> on the page showing the Captcha.

    E.g. if you added Captcha protection to a ASP.NET form using SimpleCaptcha captcha = SimpleCaptcha.load(request, "formCaptcha"), you can also use formCaptcha as the client-side Captcha object identifier.

  • using the BotDetect.getInstanceByStyleName("yourCaptchaStyleName") to get BotDetect client-side object.

    E.g.

    var captcha = BotDetect.getInstanceByStyleName("formCaptcha"); 
    

BotDetect Client-Side Object Reference
BotDetect client-side object value userInput The user input field element with the captcha code (usually a <input type="text" ... /> element)
BotDetect client-side object value captchaId The captcha id for the current captcha object
BotDetect client-side object value getInstanceByStyleName
  • string captchaStyleName
Gets the captcha instance by the captcha style name

Usage example:

.html

<div id="botdetect-captcha" data-captchastylename="yourFirstCaptchaStyle"></div> 
<input id="yourFirstCaptchaUserInput" type="text"/> 

.js

var captcha = BotDetect.getInstanceByStyleName('yourFirstCaptchaStyle'); 

// getting user entered captcha code 
var userEnteredCaptchaCode = captcha.userInput.value; 

// getting captcha id 
var captchaId = captcha.captchaId; 

// TODO: post userEnteredCaptchaCode and captchaId 
// to backend in order to validate captchas 

Please Note

This document is not up to date. Ignore it until the furher notice. We are working on fixing it. Your Simple API integration efforts should start with one of the following four step-by-step integration guides: Angular Captcha, AngularJS Captcha, jQuery Captcha, React Captcha.