Jump to content

Including Internal API in External Application ? (same file system)


Tcalp

Recommended Posts

I am working at building a custom RESTful interface to cover various aspects of our service offerings. I was wondering if it was possible for me to somehow include the 'Internal API' functionality to avoid having to make CURL calls.

Link to comment
Share on other sites

To make use of the localAPI function, your application would need access to the WHMCS-defined localAPI function. As long as your application is able to include for example, includes/functions.php, you should be good to use the internal API. Otherwise, a cURL call to the external API would be necessary.

Link to comment
Share on other sites

  • 2 months later...

if (file_exists("../init.php")) {

require("../init.php");

} else {

require("../dbconnect.php");

require("../includes/functions.php");

}

require("../includes/gatewayfunctions.php");

require("../includes/invoicefunctions.php");

 

 

$clientid = 0;

 

$postfields = array();

 

$command = "addclient";

$adminuser = "Programmer";

$values["firstname"] = "Test";

$values["lastname"] = "User";

$values["companyname"] = "WHMCS";

$values["email"] = "demo@whmcs.com";

$values["address1"] = "123 Demo Street";

$values["city"] = "Demo";

$values["state"] = "Florida";

$values["postcode"] = "AB123";

$values["country"] = "US";

$values["phonenumber"] = "123456789";

$values["password2"] = "demo";

$values["currency"] = "1";

 

$results = localAPI($command,$values,$adminuser);

print_r($results);

exit();

 

error : You did not enter your first name. WTF? What am I doing wrong?

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