Jump to content

Need help: Creating an API key


Recommended Posts

  • 1 year later...
To create a API Access key, you simply need to configure by adding a line as follows to your configuration.php file in the root WHMCS directory.

 

$api_access_key = 'secret_key_passphrase_goes_here';

 

Your API Key should comprise of letters and numbers and maybe what ever you would like.

and here is the documentation URL for anyone need it: http://docs.whmcs.com/AutoAuth

Link to comment
Share on other sites

here's a little fun function that will help you get the actual key, in case you don't want to have to create the key manually. Save as php file, anywhere is fine

<?php

function getRandomString($length = 15) {
$symb = $_GET['symb'];
if (isset($symb))
{
   $validCharacters = "abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?";
}
if (!isset($symb))
{
   $validCharacters = "abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ";
}
   $validCharNumber = strlen($validCharacters);

   $result = "";

   for ($i = 0; $i < $length; $i++) {
       $index = mt_rand(0, $validCharNumber - 1);
       $result .= $validCharacters[$index];
   }

   return $result;
}

echo getRandomString();
?>

 

This will exclude most special characters that cause issues , but leave a few in there.

Link to comment
Share on other sites

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