Jump to content

API not working (Invalid IP ***)


evcz

Recommended Posts

I'm trying this code:

 

$url = "http://www.mydomain.tld/includes/api.php"; # URL to WHMCS API file
$username = "myadminusername"; # Admin username goes here
$password = "myadminpassword"; # Admin password goes here

$postfields["username"] = $username;
$postfields["password"] = md5($password);

$postfields["action"] = "encryptpassword";
$postfields["password2"] = "aPASSwordIwantTOencrypt";

$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!
 echo $results['password'];
} else {
 # An error occured
 echo "The following error occured: ".$results["message"];
}

 

 

on many different boxes (even tried on the same box as the one running whmcs) but getting everywhere:

 

result=error;message=Invalid IP ***.***.***.***

 

what am I doing wrong?

 

I just want to integrate my own website letting the users to login with their whmcs data but I do not know which salt you are using so I've to deal with this thing called API (I really wish there was another way to get a password "encrypted"...)

 

I thought I would just do everything on my own and check if the login was valid with a simple mysql query... but found me in stuck with this damn api thing :(

Edited by evcz
Link to comment
Share on other sites

  • 5 months later...
I'm using whcms 4.1 version and i don't found this configuration, whem i put the ip number?

 

Finaly i found, the problem is in documentation,

 

in the link http://wiki.whmcs.com/API:About is write

 

When adding an API admin user, the user only needs access to the API. You must also setup the IP(s) you will be connecting from in General Settings > Other. Failure to do this will result in an error Invalid IP

 

BUT TO CONFIGURE THE IP IS IN THE TAB SECURITY

Link to comment
Share on other sites

  • 1 year later...
  • 11 years later...
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated