Blocking an IP Address with the FileCOPA Command Server
You can use the FileCOPA Command Server to block IP addresses. This is a brief example of how to block an IP address using PHP connecting to the FileCOPA command Server.
<?php
$adduser_xml ="<?xml version='1.0' encoding='utf-8'?>\n";
$adduser_xml.="<block>\n";
$adduser_xml.="<address>192.168.1.1</address>\n";
$adduser_xml.="</block>\n";
$username="commanduser";
$password="commandpassword";
$c=curl_init();
curl_setopt($c,CURLOPT_URL, "http://192.168.10.5/denyipaddress");
curl_setopt($c,CURLOPT_PORT,7498);
curl_setopt($c,CURLOPT_USERPWD,$username.":".$password);
curl_setopt($c,CURLOPT_POSTFIELDS,$adduser_xml);
curl_setopt($c,CURLOPT_HTTPHEADER,array("Connection: Close"));
$result=curl_exec($c);
if(curl_errno($c)) print("<p>Error - " . curl_errno($c) . " - " . curl_error($c) . "</p>\n");
else {
$resultcode=curl_getinfo($c,CURLINFO_HTTP_CODE);
print("<p>Result Code: " . $resultcode . "</p>\n");
}
curl_close($c);
?>