Description

This function adds a deny from IP line to the account's .htaccess file.

Examples 




$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$deny_ip = $cpanel->api1('DenyIp', 'adddenyip', array('192.168.0.1','0') ); // Call the function.



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $deny_ip = $cpliveapi->api1('DenyIp', 'adddenyip', ['192.168.0.1','0'] ); # Call the function.

 


<cpanel Module="DenyIp::adddenyip( $FORM('ip','quiet') )">




cpapi1 --user=username DenyIp adddenyip 192.168.0.1 0



Users from the IP address(s) 192.168.0.1 will not be able to access your site.




Parameters

ParameterTypeDescriptionPossible valuesExample
ip

string

Required

The IP address or addresses to deny.

A single IP address, or a range of addresses as follows:

ExampleDescription

192.168.0.1

Single IP Address

192.168.0.1-192.168.0.58

Range

192.168.0.1-58

Implied Range

192.168.0.1/16

CIDR Format, which matches 192.168.*.*
10.Matches 10.*.*.*


192.168.0.1

 

quietBooleanWhether to suppress error messages.
  • 1 — Hide error messages.
  • 0 — Display error messages.
0

Returns

  • If it succeeded, the function returns a message of success.
  • If it failed, this function returns any errors, unless you set the quiet parameter to 1.