Jump to content

API - sendquote (http://docs.whmcs.com/API:Send_Quote)


Sp0tteh

Recommended Posts

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??

Link to comment
Share on other sites

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

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