toshu Posted October 10, 2019 Share Posted October 10, 2019 hi i have write a hook for clientAdd. what i am expecting is after creating/adding client it should call my hook and post all fields data to my other server to create that cllient in my database. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); define('BASE_URL','http://mydomain.com:4212/'); function add_client($vars) { $url=BASE_URL.'createclient'; $header[]='Authorization: custom:gventure'; $header[]='Content-Type: application/json'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, count($post_data)); curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($vars)); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); $data=json_decode($result,true); error_log(print_r($vars, true), 3, __DIR__.'/file.log'); //DID nothing :( return $data["records"]; } add_hook("ClientAdd",1,"add_client"); ?> Other details: filename is myhook.php just place under /includes/hooks/ directory is there any other setting i have to do in the code or panel? like registering my hooks i dont get it actually. i didnt get any hit from my side. using nodajs from my side. 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.