openmind Posted April 6, 2010 Share Posted April 6, 2010 Now as I''m a ColdFusion programmer by trade, PHP is not my strong point But moving on... What I would like to do is have a simple action hook that fires the whmcs vars to an offsite script. Theis script will then run my CF code. So in pseudo code: function create_forum_account($vars) { post vars to http://www.domain.com/myscript.cfm } add_hook("ClientAdd",1,"create_forum_account"); Can anyone provide the PHP script to simply post the vars to a location of my choosing please? 0 Quote Link to comment Share on other sites More sharing options...
openmind Posted April 6, 2010 Author Share Posted April 6, 2010 Would something like this work? function create_forum_account($vars) { //set POST variables $url = 'http://domain.com/myscript.cfm'; //url-ify the data for the POST foreach($vars as $key=>$value) { $vars_string .= $key.'='.$value.'&'; } rtrim($vars_string,'&'); } //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($vars)); curl_setopt($ch,CURLOPT_POSTFIELDS,$vars_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); add_hook("ClientAdd",1,"create_forum_account"); Note that I'm using the create_forum_account as an example, I would want this to work with any function, just post the vars as I can handle the incoming data with my script... 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.