STOPBOT.NET Documentation
  • MAIN
    • Introduction
    • Workflow Overview
  • API DOCUMENTATION
    • Getting Started
    • Account
    • Blocker
    • Blocker V2
    • Smart URLs
    • IP Lookup
    • Email Validation
    • Email Verifier
    • Phone Number Identify
  • SERVICE GUIDES
    • STOPBOT
      • Blocker
      • Smart URLs
      • Blocker V2
  • PANEL GUIDES
    • Panel Overview
    • Dashboard
    • Account
      • My Account
      • Recent Logs
      • Payments
      • Redeem Coupons
    • Plans & Pricing
      • Payment
    • Services
      • STOPBOT
        • BLOCKER
        • Smart URLs
        • Optional
          • BOT Redirect
          • Blacklist IP
          • Whitelist IP
    • Apikey
  • INFORMATION
    • Affiliate
    • Status
      • Server
    • Update Logs
    • FAQ
    • Privacy Policy
    • Terms of Services
Powered by GitBook
On this page
  • INTEGRATION GUIDE
  • VIDEO
  • DOCUMENTATION
  1. SERVICE GUIDES
  2. STOPBOT

Blocker

PreviousSTOPBOTNextSmart URLs

Last updated 1 year ago

Identify whether website visitors are real users or bots. It employs various checks such as user-agent analysis, IP blacklist verification, detection of proxies/Tor/VPNs, identification of malicious IPs, hostname blacklist checks, and threat URL detection. By conducting these checks, the Blocker helps protect websites from malicious activities and security threats. It distinguishes between legitimate users and suspicious or malicious visitors, enhancing website security and preventing unauthorized access. While a Blocker provides effective security measures, continuous updates and monitoring of threat databases are essential to stay ahead of evolving bot techniques and emerging threats.

INTEGRATION GUIDE

Please follow the instruction as shown in the video or documentation provided.

VIDEO

Here is a video guide on integrating Blocker into your server.

DOCUMENTATION

Here is the documentation guide on integrating Blocker into your server.

BITVISE

  • Login into your server

  • Open New SFTP window

  • Open your main web dir "/var/www/" or the directory that you already specified

  • Create a file named blocker.php and then fill it with the following code:

blocker.php
<?php
/*
     _              _           _                _   
    | |            | |         | |              | |  
 ___| |_ ___  _ __ | |__   ___ | |_   _ __   ___| |_ 
/ __| __/ _ \| '_ \| '_ \ / _ \| __| | '_ \ / _ \ __|
\__ \ || (_) | |_) | |_) | (_) | |_ _| | | |  __/ |_ 
|___/\__\___/| .__/|_.__/ \___/ \__(_)_| |_|\___|\__|
             | |                                     
             |_|                                     
                      [Example Code Blocker]

Guide   : https://docs.stopbot.net/service-guides/stopbot/blocker
Website : stopbot.net
contact : t.me @stopbotnet
*/

/* START CONFIGURATION */

#Put your Apikey here.
$Apikey = "________________________________";

# 0. Turn off
# 1. Turn on
$BotControl = 1;

# RedirectURL 
# Leave it blank for http_code 404 response
$RedirectURL = "https://www.google.com";

/* END CONFIGURATION */

if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
    $_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
$client  = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote  = $_SERVER['REMOTE_ADDR'];
        
switch(true){
    case (filter_var($client, FILTER_VALIDATE_IP)):
        $Ip = $client;
        break;
    case(filter_var($forward, FILTER_VALIDATE_IP)):
        $Ip = $forward;
        break;
    default:
        $Ip = $remote;
        break;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://stopbot.net/api/blocker?apikey=".$Apikey."&ip=".$Ip."&ua=".urlencode($_SERVER['HTTP_USER_AGENT'])."&url=".urlencode($_SERVER['REQUEST_URI'])."&".rand(1,1000000));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$response = curl_exec($ch);
switch(true){
    case !$response:
        file_put_contents("stopbot.txt", "[".date("D/m/y H:i:s")."] -> Request Timeout\r\n", FILE_APPEND);
        break;
    default:
        $resp = json_decode($response, true);
        switch($resp['status']){
            case "error":
                file_put_contents("stopbot.txt", "[".date("D/m/y H:i:s")."] -> ".$resp['message']."\r\n", FILE_APPEND);
                break;
            case "success":
                switch(true){
                    case $resp['IPStatus']['BlockAccess'] == 1 && !empty($RedirectURL):
                        header("Location: ".$RedirectURL);
                        die();
                        break;
                    case $resp['IPStatus']['BlockAccess'] == 1 && empty($RedirectURL):
                        http_response_code(404);
                        die();
                        break;
                }
                break;
            default:
                file_put_contents("stopbot.txt", "[".date("D/m/y H:i:s")."] -> Unknown error\r\n", FILE_APPEND);
                break;

        }
        break;
}
#Put your Apikey here.
$Apikey = "________________________________";
  • Open your index.php file, then add this code on the first line, then save.

<?php include_once "blocker.php"; ?>

If you're still having trouble installing Blocker, please contact us for assistance.

Replace apikey with your API key ( for APIKey), then save.

For information regarding visitor statistics, for details.

Click here
click here