Sp0tteh Posted November 5, 2011 Share Posted November 5, 2011 Hey, I've managed to create a client through the API, and then create a quote againts that new client. However when i try to send the quote to the client i get the following debug output from PHP: Request: Array ( [username] => api [password] => 6a838dd3ce7761a4171563df60370311 [responsetype] => json [action] => sendquote [quoteid] => 1084 ) Response: Array: Im using the example code from (http://docs.whmcs.com/API:JSON_Sample_Code) : $username = "removed"; # Admin username goes here $password = "removed"; # Admin password goes here $postfields = array(); $postfields["username"] = $username; $postfields["password"] = md5($password); $postfields["responsetype"] = "json"; $postfields["action"] = "sendquote"; $postfields["quoteid"] = 1084; $query_string = ""; foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $jsondata = curl_exec($ch); if (curl_error($ch)) die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch)); curl_close($ch); $arr = json_decode($jsondata); # Decode JSON String print_r($arr); # Output XML Response as Array //Debug Output - Uncomment if needed to troubleshoot problems echo "<textarea rows=50 cols=100>Request: ".print_r($postfields,true); echo "\nResponse: ".htmlentities($jsondata)."\n\nArray: ".print_r($arr,true); echo "</textarea>"; Ive tried both the JSON and XML exmaples. I'm using the exact same code as I have for the "createclient" and "createquote". Only changed the action to "sendquote" and added the "quoteid". When I go into WHMCS and open the quote i can send the email, so its like the API call has been renamed or something. Anyone used this API call before? or can see that I've done something wrong?? 0 Quote Link to comment Share on other sites More sharing options...
security_man Posted November 7, 2011 Share Posted November 7, 2011 i am having the same issue. basically the api returns nothing and does nothing so the array is empty. same thing with acceptquote 0 Quote Link to comment Share on other sites More sharing options...
Sp0tteh Posted November 8, 2011 Author Share Posted November 8, 2011 i am having the same issue. basically the api returns nothing and does nothing so the array is empty. same thing with acceptquote Hey, Matt sent through a fixed version of the "sendquote.php" file. I have attached this for you. Unfortunately i don't have a working "acceptquote.php" as it wasn't one i needed. Sorry. Here's the result i now get with the new file: Request: Array ( [username] => api [password] => 6a838dd3ce7761a4171563df60370311 [responsetype] => json [action] => sendquote [quoteid] => 1084 ) Response: {"result":"success"} Array: stdClass Object ( [result] => success ) Regards Jason sendquote.zip 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.