Hi, I tried to use WHMCS' API but something wrongs.
This is my code:
But, when I'm going to the page, this error appears:
result=error;message=Authentication Failed;
IP address has been added on IP allowed list, and for the API account, the API access is checked.
How can I resolve this problem ? Thank you in advance
- - - Updated - - -
I tried too to go directly on https://mywhmcs.com/whmcsfolder/includes/api.php?username=api-username&password=md5-encoded-password page
but, on this page, I get "result=error;message=Authentication Failed;" error too.
(IP address allowed and API access checked on user group)
This is my code:
PHP Code:
<?php
$url = "https://mywhmcs.com/whmcsfolder/includes/api.php";
$username = "api-username";
$password = "api-password";
$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "addcredit";
$postfields["clientid"] = "116";
$postfields["description"] = "test";
$postfields["amount"] = "1.20";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$data = explode(";",$data);
foreach ($data AS $temp) {
$temp = explode("=",$temp);
$results[$temp[0]] = $temp[1];
}
if ($results["result"]=="success") {
# Result was OK!
} else {
# An error occured
echo "The following error occured: ".$results["message"];
}
?>
Quote:
result=error;message=Authentication Failed;
IP address has been added on IP allowed list, and for the API account, the API access is checked.
How can I resolve this problem ? Thank you in advance
- - - Updated - - -
I tried too to go directly on https://mywhmcs.com/whmcsfolder/includes/api.php?username=api-username&password=md5-encoded-password page
but, on this page, I get "result=error;message=Authentication Failed;" error too.
(IP address allowed and API access checked on user group)