asdasdqwe Posted May 26, 2009 Share Posted May 26, 2009 <?php $url = "https://domain.com/includes/api.php"; # URL to WHMCS API file $username = "xxxx"; # Admin username goes here $password = "xxxx"; # Admin password goes here $postfields["action"] = "openticket"; $postfields["clientid"] = "545"; $postfields["subject"] = "API Ticket"; $postfields["message"] = "This is a sample ticket opened by the API"; $postfields["priority"] = "Low"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $data = curl_exec($ch); curl_close($ch); $data = explode(";",$data); foreach ($data AS $temp) { $temp = explode("=",$temp); print $results[$temp[0]] = $temp[1]; } if ($results["result"]=="success") { # Result was OK! } else { # An error occured echo "The following error occured: ".$results["message"]; } ?> php sendemail.php errorAuthentication FailedThe following error occured: Authentication Failed[ username and password is correct. Don't know what is wrong 0 Quote Link to comment Share on other sites More sharing options...
atDev Posted May 26, 2009 Share Posted May 26, 2009 Please review the example in the manual again, you are missing the two lines that add the username/password to the $postfields array. 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.