BotDetect CAPTCHA Simple API Reference
- Backend SimpleCaptcha Class
- Frontend BotDetect Object
SimpleCaptcha Class ASP.NET Version Reference
BotDetect.Web.SimpleCaptcha Class Reference | ||
---|---|---|
SimpleCaptcha | The SimpleCaptcha constructor | |
bool Validate
|
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 | ||
---|---|---|
SimpleCaptcha | The SimpleCaptcha constructor | |
bool validate
|
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 | ||
---|---|---|
SimpleCaptcha | The SimpleCaptcha constructor | |
bool Validate
|
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 usingthis
.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 useformCaptcha
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 | ||
---|---|---|
userInput | The user input field element with the captcha code (usually a <input type="text" ... /> element) |
|
captchaId | The captcha id for the current captcha object | |
getInstanceByStyleName
|
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. 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.
Current BotDetect Versions
-
BotDetect ASP.NET CAPTCHA
2019-07-22v4.4.2 -
BotDetect Java CAPTCHA
2019-07-22v4.0.Beta3.7 -
BotDetect PHP CAPTCHA
2019-07-22v4.2.5