didier1 Posted November 20, 2013 Share Posted November 20, 2013 Hi, I was able to add a client with the same php structure, but when I am trying to use the getproducts command to display a product in a certain group, I have the error message :' the following error occur : ' with actually no error displayed. I verified the the product is active ans not hidden. Is there any other line I need to add ? I am expecting to get an XML answer from server displaying the product so customer could order from their. Is it right ? You help is grealty appraciated : <?php $url = "http://www.XXX/whmcs/includes/api.php"; # URL to WHMCS API file $postfields["username"] = "XXX"; # Admin username goes here $postfields["password"] = md5("XXX"); # Admin password goes here $postfields["action"] = "getproducts"; $postfields["gid"] = "5"; $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); $results[$temp[0]] = $temp[1]; } if ($results["result"]=="success") { # Result was OK! } else { # An error occured echo "The following error occured: ".$results["message"]; } ?> 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.