Warning: Use of undefined constant issss - assumed 'issss' (this will throw an Error in a future version of PHP) in /var/www/websites/executorapi.php(1411) : eval()'d code on line 1

Warning: Use of undefined constant issss - assumed 'issss' (this will throw an Error in a future version of PHP) in /var/www/websites/executorapi.php(1411) : eval()'d code on line 1

Documentation


Implement NullCaptcha On Your Application

NullCaptcha is not limited to just websites; it can be used on any applications with internet access to help prevent spam as well as brute-forcing attempts. NullCaptcha is a RESTful web service used for purposes such as web forms that need spam protection. To get started, go to "My Account" and create a subscription to obtain your public and private API keys. Unlike other services out there, multiple websites and applications can utilize the same subscription with the same public and private keys. Once, you have your API keys, you're ready to get started! Below is a basic explanation of implementing NullCaptcha for a website (further examples for other application can be found on the left navigation). NullCaptcha can be implemented on your website or application in only a few lines of code. For the fast and easy approach, use our code examples to the left!

1) Initialize Your Request

To initialize and incorporate NullCaptcha on your website, a request is called at the end of your web form that you want to incorporate NullCaptcha's spam protection on. This request is called from the endpoint https://nullcaptcha.com/nc.php with the server variable "privatekey" passed to it containing your private API key. Sending a request to this page (with your private key) ques our database to anticipate your web request as well as sets up additional hidden fields and parameters for spam validation. An example is below written in PHP. Note, the optional server variable of "badge" (boolean) can be passed to our systems. If set to "1" for true, the NullCaptcha badge will be display on your web form. If set to "0" for zero, it will be hidden. (documentation containing additional parameters for our system will be provided in the near future, including customization of spam filtering).

			<form method="post" id="yourwebform">
	<?php
		define("PRIVATE_KEY", "YOUR PRIVATE KEY HERE");

        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL, "https://nullcaptcha.com/nc.php?privatekey=" . PRIVATE_KEY . "&badge=1"); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
        $output = curl_exec($ch); 
        echo $output;
        curl_close($ch);     
	?>
</form>

		

2) Spam Validation

On the page you are submitting your web form to, you will make a request to the endpoint https://nullcaptcha.com/validate.php, posting your public and private keys with your request, along with the all of the data you want spam-checked. Below is an example in PHP. In this example, the $_REQUEST variable (which, in PHP, contains both $_GET and $_POST data) are send to our servers to validate if they are spam or not. Additionally, we pass the user agent and IP address from the requester as well (these fields are NOT required, however greatly improve our spam validation algorithms, comparing against common spam IP's and user agents). You have total control over what data you want us to validate as spam.

			<?php
	# Replace with your public and private keys here
	define("PUBLIC_KEY", "YOUR PUBLIC KEY HERE");
	define("PRIVATE_KEY", "YOUR PRIVATE KEY HERE");

	# Create request and pass your server variables to the validation page along with private and public keys
	$ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, "https://nullcaptcha.com/validate.php"); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1); 
    $postData = $_REQUEST;
    $postData['publickey'] = PUBLIC_KEY;
    $postData['privatekey'] = PRIVATE_KEY;

    # Optionally pass us the user agent and IP address info
    $postData['nullcaptchaip'] = $_SERVER['REMOTE_ADDR'];
	$postData['nullcaptchaagent'] = $_SERVER['HTTP_USER_AGENT'];

	# Submit request
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    $output = curl_exec($ch); 

    # Output - nullcaptcha will return a boolean value of "1" (true) if spam was detected, "0" (false) if not
    if ($output == 1)
    {
    	# Spam detected - code to turn away spam goes here
    }
    else 
    {
    	# No spam detected - code to validate 
    }

    echo $output;
    curl_close($ch);  
	
?>