Snapwp Posted June 27, 2020 Share Posted June 27, 2020 Hey Everyone, I'm been working on a Open ticket hook. It's quite simple when a ticket is opened It should send off a curl request to my own api to then use a third twillo to call someone on call. The issue is that for some the PHP code works find when trigger this manally for the WHMCS hook won't trigger. <?php add_hook('TicketOpen', 1, function($vars){ $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,'http://snappyhost.co.uk/api-test.php'); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)){ print "Nothing returned from url.<p>"; } else{ $file = 'call.log'; $message = $buffer; file_put_contents($file, $message, FILE_APPEND); } add_hook('TicketUserReply', 2, function($vars) { $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,'http://snappyhost.co.uk/api-test.php'); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)){ print "Nothing returned from url.<p>"; } else{ $file = 'logs/call.log'; $message = $buffer; file_put_contents($file, $message, FILE_APPEND); } }); Any help with why this may not trigger would be great! 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.