flush cphulk with api1 (xmlapi.php) not working
I'm trying to use a script to whitelist, and then flush the cphulk block for a specific IP address. I've found plenty of documentation for the API1 example of doing this, but nothing seems to work when using the xmlapi.php module. The following is the current code I'm using. Anyone have insight as to why this won't work?
The output is as follows.
Please note that I had tried using "root" as parameter number 1 to api1_query, but that failed with a message about not being associated with a cpanel account. So I had to replace it with a customers username, even though I don't believe that should be necessary to flush the IP's.
= 'localhost';
$config['cpanel_user"> = 'root';
$config['cpanel_pass"> = 'MYPASSWORD';
echo "Creating object\n";
$c = new xmlapi($config['cpanel_ip">);
echo "Autenticating\n";
$c->password_auth($config['cpanel_user">, $config['cpanel_pass">);
echo "Setting output\n";
$c->set_output('array');
$ar = array('ip'=>'192.168.1.1');
echo "Making the call\n";
$res = $c->api1_query('SOMEUSER','cPHulk','flush_cphulk_login_history_for_ips',$ar);
echo "-- Result --\n";
print_r($res);
echo "-- done --\n"
?>
The output is as follows.
# php -q t.php
Creating object
Autenticating
Setting output
Making the call
-- Result --
Array
(
[module] => cPHulk
[func] => flush_cphulk_login_history_for_ips
[type] => event
[source] => module
[apiversion] => 1
[data] => Array
(
[0] => Array
(
)
)
[event] => Array
(
[reason] => cPHulk::flush_cphulk_login_history_for_ips() failed: Can't use string ("") as a subroutine ref while "strict refs" in use at cpanel.pl line 1740.
[result] => 0
)
[postevent] => Array
(
[result] => 1
)
[preevent] => Array
(
[result] => 1
)
[error] => cPHulk::flush_cphulk_login_history_for_ips() failed: Can't use string ("") as a subroutine ref while "strict refs" in use at cpanel.pl line 1740.
)
-- done --
Please note that I had tried using "root" as parameter number 1 to api1_query, but that failed with a message about not being associated with a cpanel account. So I had to replace it with a customers username, even though I don't believe that should be necessary to flush the IP's.
-
Hello :) Please ensure you review some of the examples at: Thank you. 0
Please sign in to leave a comment.
Comments
1 comment