Introduction to custom WHMCS API functions
Are you not satisfied with default WHMCS API functions? In this little note I introduce you a very basic template for a custom API function.
First of all you should know every API function is a separate file stored at whmcs_folder/includes/api/.
So you should create you own file, all lowercase, same as your function name. For example yourcustomfunc.php
Also you need to know that:
The file dbconnect.php is included. This establishes a mysql connection.
The file includes/functions.php is included. This hold various WHMCS commands.
Security
You’ll need to make sure nobody can call your file directly.
if (!defined("WHMCS")) die("This file cannot be accessed directly");
Passing arguments to API function
All the parameters you passed via API call are available as $_POST variables
The next part is limited just by your fantasy. You can make queries, get/update/delete data as you want.
<?php /* Custom API Function Name the file all lowercase and with the command to call Save File To: /includes/api/ */ if (!defined("WHMCS")) die("This file cannot be accessed directly"); ?>
Good luck with extending WHMCS!