Get list admins using PHP 500 internal server error

rbm

New member
Joined
Jan 27, 2021
Messages
3
I have script in PHP to get list of admins:
PHP:
<?php

include '../config/config.php';
include '../protocol/httpsocket.php';
$Socket = new HTTPSocket;

$Socket->connect($siteurl,$siteport);
$Socket->set_login($adminusername,$adminpassword);

try {
    $Socket->query('/CMD_API_SHOW_ADMINS','');

} catch (Exception $e) {
    echo "error";
   // echo 'Caught exception: ',  $e->getMessage(), "\n";
}
finally {
    echo "First finally.\n";
}
?>

I get error 500 Internal Server Error.
When I comment:
PHP:
$Socket->query('/CMD_API_SHOW_ADMINS','');
I get 200, it works, set_login works. Password and username are the same that I use to login to DirectAdmin using webpage.

And I don't understand why catch don't handle exception and return status 500 ?
 
Back
Top