jeremyhaber Posted March 1, 2011 Share Posted March 1, 2011 Hey Guys and Gals; Ever wanted to build your own custom API modules? Through my days of creating OAuth I figured out the age old questions, how do I create my own API command and how do I include the WHMCS API locally without making a request to the WHMCS API. I have fully commented the code below for your benefit and understanding on this. <?php /* Custom API Function Name the file all lowercase and with the command to call Save File To: /includes/api/ The following are defined by the OAuth Server: ROOTDIR is a constant that holds the absolute path of WHMCS install The file dbconnect.php is included. This establishes a mysql connection. The file includes/functions.php is included. This hold various WHMCS commands. */ // $silent is defined as true if its valid API request. Else denies them access.... // Do not define silent! It is defined by the OAuth server! if ($silent == true) { } Though this was created for OAuth server I created. The same principles do apply to the actual WHMCS API. Including dbconnect.php and includes/functions.php into your code and defining "$silent = true" will allow you to use the API anywhere throughout your site. Hope this helps and happy developing! 0 Quote Link to comment Share on other sites More sharing options...
ckung Posted March 1, 2011 Share Posted March 1, 2011 Thanks for the tip. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 1, 2011 Share Posted March 1, 2011 I was to the understanding that the $silent variable was only used to not send out email while calling the sendmessage function. 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted March 1, 2011 Author Share Posted March 1, 2011 I was to the understanding that the $silent variable was only used to not send out email while calling the sendmessage function. It would seem that WHMCS uses silent throughout their platform then. Thanks for that tip Sparky. I actually wasn't aware of that 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.