Reputation: 1
I can't get the API to trigger using the following code. There is no problem with the connection via token. The issue is, nothing hits the logs indicating AutoSSL is being started. In fact, I can use an invalid cpanel_username and still get the "NO WHM Errors" message. Permissions for the token are FULL (for testing).
To clarify, the connection is made to the server with a valid token but the API is not starting the start_autossl_check_for_one_user operation.
Any help is appreciated. Using this guide here:
https://api.docs.cpanel.net/openapi/whm/operation/start_autossl_check_for_one_user/
Code I'm trying:
$whm_user = 'root';
$token = "VALIDTOKENISHEREANDWORKING";
$cpanel_username = "valid_cpanel_username_is_here";
$query = "https://myserver.com:2087/json-api/start_autossl_check_for_one_user?api.version=1&username=" . $cpanel_username;
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$header[0] = "Authorization: whm $whm_user:$token";
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl, CURLOPT_URL, $query);
$result = curl_exec($curl);
$result = json_decode($result,true);
if(isset($result['cpanelresult']['error'])){
echo $result['cpanelresult']['error'];
die();
} else {
echo "NO WHM Errors: SSL Check Started";
}
curl_close($curl);
Upvotes: 0
Views: 9