ravex Posted December 15, 2016 Share Posted December 15, 2016 Hi everyone I have a contact form on my website that is using the API to open tickets when people contact me via the site. However, if a client that already has an account contacts me new tickets do not get assigned to them, they show up as a guest ticket. How would I go about finding the client ID, to then assign the new ticket to that client without any intervention from my staff or myself? The code I am using at the moment is: $url = "https://apipath"; $postfields["username"] = "apiuser"; $postfields["password"] = md5("apipass"); $postfields["action"] = "OpenTicket"; $postfields["deptid"] = "1"; $postfields["name"] = $this->input->post('name'); $postfields["email"] = $this->input->post('email'); $postfields["subject"] = "New message via the contact form"; $postfields["message"] = $this->input->post('message'); $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); Many Thanks Paul 0 Quote Link to comment Share on other sites More sharing options...
pablobaldovi Posted December 15, 2016 Share Posted December 15, 2016 Hello. First you have to validate if the client is correct using the API. http://Http://docs.whmcs.com/API:Validate_Login This will return you if it is correct and the userid Then you would create a new ticket using http://docs.whmcs.com/API:Open_Ticket As you already have the id you do not need to include the email 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.