New Extension for Plesk. Antivirus Protection to enhance your server security. Why choose Flex Antivirus?

API — Web Programming

Unblock an IP from the Firewall

Integrates IP unblocking functionality directly into your web application. Compatible with classic ASP and PHP via the extension's COM object.

Classic ASP PHP XML / JSON

Function UnlockIP(IP,Rulename)

From your web page — in your index.asp, index.php, or any section of your application — you can call this function to programmatically unblock an IP address that has been blocked by Firewall Manager. It requires valid credentials for a domain in Plesk.

1 Required parameters


Parameter Type Required Description
Username String Required Plesk domain user with access to the extension.
Password String Required Password for the Plesk domain user.
FormatOutput String Optional Response format: xml (default) or json.
IP String Required IPv4 or IPv6 address to be unblocked.
Rulename String Optional Name of the rule containing the IP
XML/JSON return values
result
(true or false) Status of the unblock request.
rulename
Name of the rule that contained the unblocked IP.
app
Site where it was blocked: Windows, MailEnable, Cloudflare
desc
If the result is negative, it will show information about the reason.

Important: Use this function on pages protected with your own authentication. Exposing the call without protection allows any user to unblock arbitrary IPs.

2 Classic ASP example


Instantiate the FlexFirewallManager.Admin COM object, set the credentials, and call UnlockIP(). The response is parsed as XML.

' Create COM object instance Set App = CreateObject("FlexFirewallManager.Admin") App.FormatOutput = "xml" App.Username = "Plesk Domain User" App.Password = "Plesk Domain Password" ' IP to unblock Dim strIP : strIP = "123.123.123.123" Dim returnstring : returnstring = App.UnlockIP(strIP) ' Parse XML response Set objxml = CreateObject("Msxml2.DOMDocument") objxml.LoadXml(returnstring) If LCase(objxml.SelectSingleNode("/output/result").text) = "true" Then Response.Write "IP Unblocked " & strIP Else Response.Write "Unable to unblock IP " & strIP End If

You can use FormatOutput = "json" if you prefer to parse the response with JSON.parse instead of XML. JSON format is recommended for modern applications.

3 PHP example


In PHP, instantiate the COM object with new COM(). Use json format to parse the response directly with json_decode().

// Create COM object instance $app = new COM("FlexFirewallManager.Admin"); $app->FormatOutput = "json"; $app->Username = "Plesk Domain User"; $app->Password = "Plesk Domain Password"; // IP to unblock $strIP = "123.123.123.123"; $returnstring = $app->UnlockIP($strIP); // Parse JSON response $appjson = json_decode($returnstring); if ($appjson->result) { echo "IP Unblocked " . $strIP; } else { echo "Unable to unblock IP " . $strIP; }

Tip: You can combine this function with an internal administration form so your users can self-manage unblocking their own IP without needing access to the Plesk panel.

4 Implementation notes


Keep the following in mind when integrating this function into your application:

Prior authentication Always protect the page that calls UnlockIP() with an authenticated user session.
Windows Server only The FlexFirewallManager.Admin COM object requires Windows Server with the extension installed.
Secure credentials Never include the username and password in publicly accessible source code. Use environment variables or external configuration files.
Cloudflare synchronization If you have Cloudflare integration enabled, unblocking will also automatically remove the IP from Cloudflare's rules.