cloudtech Posted November 6, 2011 Share Posted November 6, 2011 Hello, I try to use the localAPI but get this error. Thanks for any help. Fatal error: Call to undefined function localAPI() in /home/xxx/public_html/whmcs/test.php on line 9 <?php # Set Vars $command = 'SendEmail'; $values = array( 'messagename' => 'Test Template', 'id' => '6', ); $adminuser = 'admin'; # Call API $results = localAPI($command,$values,$adminuser); if ($results['result']!="success") echo "An Error Occurred: ".$results['result']; ?> 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted November 7, 2011 Share Posted November 7, 2011 be sure you included the following files: require("dbconnect.php"); require("includes/functions.php"); require("includes/clientareafunctions.php"); The functions.php is required for localAPI func I guess. 0 Quote Link to comment Share on other sites More sharing options...
cloudtech Posted November 7, 2011 Author Share Posted November 7, 2011 be sure you included the following files: require("dbconnect.php"); require("includes/functions.php"); require("includes/clientareafunctions.php"); The functions.php is required for localAPI func I guess. Thanks sdemidko. I tried including those files, but got another error when I run it. ##Error An Error Occurred: error ##The test script <?php require("/home/xxx/www/whmcs/dbconnect.php"); require("/home/xxx/www/whmcs/includes/functions.php"); require("/home/xxx/www/whmcs/includes/clientareafunctions.php"); # Set Vars $command = 'SendEmail'; $values = array( 'messagename' => 'Test Template', 'id' => '6', ); $adminuser = 'admin'; # Call API $results = localAPI($command,$values,$adminuser); if ($results['result']!="success") echo "An Error Occurred: ".$results['result']; ?> 0 Quote Link to comment Share on other sites More sharing options...
sdemidko Posted November 7, 2011 Share Posted November 7, 2011 try print out $results variable right after call there might be an explanation also be sure you using user ID in sendemail function the template you mentioned should be in "General" section otherwise system will expect product ID or invoice ID (Product Messages and Invoice Messages sections respectively) 0 Quote Link to comment Share on other sites More sharing options...
cloudtech Posted November 7, 2011 Author Share Posted November 7, 2011 I got an answer from support staff. I used it in wrong way. The localAPI has to be used within a WHMCS script like a hook, addon or module, you cannot create standalone files using the localAPI function. 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.