Xeron Posted February 27, 2010 Share Posted February 27, 2010 Hi, What I need to have is before a domain is registered so action hook PreDomainRegister that the domain name is send to another system. So for example if the domain = test.com I need it to send test.com throw destination.com/index.php?domain=test.com Hope somebody can help me how i need to do this, everything i tried did not work at all 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted February 28, 2010 Share Posted February 28, 2010 You will need to give more details as the way you have above nothing will happen at destination.com/index.php?domain=test.com unless a call to the page happens and as the client is on your whmcs site page and will stay it can not be your client. I think you need to store the info at destination.com/index.php?domain=test.com or what is happening there? 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 You will need to give more details as the way you have above nothing will happen at destination.com/index.php?domain=test.com unless a call to the page happens and as the client is on your whmcs site page and will stay it can not be your client. I think you need to store the info at destination.com/index.php?domain=test.com or what is happening there? At the moment destination.com/index.php?domain=… receives a domain it will be added to his database. The thing is, I only need to have the domain name test.com (or whatever whmcs tells on predomainregister) send to destination.com/index.php so he can add it to his database. 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 For example my last try: <?php function create($vars) { $domain = $vars["domain"]; echo " <form id=\"send\" action=\"http://destination.com/add.php\" method=\"post\"> <input name=\"domain\" value=\"<?php echo $domain; ?>\" type=\"text\" /> </form> <script type=\"text/javascript\"> function myfunc () { var frm = document.getElementById(\"send\"); frm.submit(); } window.onload = myfunc; </script>"; } add_hook("PreDomainRegister",0,"create"); ?> 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 For example my last try: <?php function create($vars) { $domain = $vars["domain"]; echo " <form id=\"send\" action=\"http://destination.com/add.php\" method=\"post\"> <input name=\"domain\" value=\"<?php echo $domain; ?>\" type=\"text\" /> </form> <script type=\"text/javascript\"> function myfunc () { var frm = document.getElementById(\"send\"); frm.submit(); } window.onload = myfunc; </script>"; } add_hook("PreDomainRegister",0,"create"); ?> That's not possible. Is this only something what should be posted on the background, or does the client als needs to get a output from that post? 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 No, it only needs to send the domain given by WHMCS to the other system so he can add it to his database. 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 (edited) You can try something like this: <?php function create($vars) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://destination.com/add.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array("domain" => $vars['domain'])); $data = curl_exec($ch); curl_close($ch); } add_hook("PreDomainRegister", 0, "create"); ?> It will be executed at the background. The client doesn't get any output from the hook process. Edited February 28, 2010 by m00 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 I tried but get: Warning: Cannot modify header information - headers already sent by (output started at /home/whmcs/includes/hooks/domain_hook.php:15) in /home/whmcs/admin/ordersadd.php on line 0 Line 15 = ?> 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 Remove all spaces after the ?>. 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 Ok that did the trick only the domain is not added on the other system Current code there to get the domain variable if (isset($_POST['domain'])) { $domain = trim($_POST['domain']); } elseif (isset($_REQUEST['domain'])) { $domain = trim($_REQUEST['domain']); } else { $domain = ""; } 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 (edited) Ok that did the trick only the domain is not added on the other system Current code there to get the domain variable if (isset($_POST['domain'])) { $domain = trim($_POST['domain']); } elseif (isset($_REQUEST['domain'])) { $domain = trim($_REQUEST['domain']); } else { $domain = ""; } That script shouldn't give any problems. To start with, you can add this to your "add.php" page: mail("your@email.address","Domain Add","The domain add page was called.\n\nVariables:\n".print_r(get_defined_vars(), true)); It will send you an e-mail when the page is called (to verify that the action hook does it's job). In that e-mail are also the declared variables. Based on that, you can try to customize the add script. Edited February 28, 2010 by m00 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 I don't get an e-mail, I also don't see anything in the access log that add.php has been called. 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 ********* - - [28/Feb/2010:14:33:06 +0100] "GET /add.php HTTP/1.1" 200 557 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)" was the last log 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 Add the following line under $data = curl_exec($ch); in your action hook: if(curl_exec($ch) === false) die(curl_error($ch)); If there's a problem with the connection, it will display the error. 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 also dont get a error, is this action hook working when i add an domain order throw the admin? 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 When I send a domain name to the registrar, it just activates the action hook on my test environment. <?php function testje($vars) { die("stop!"); } add_hook("PreDomainRegister", 1, "testje"); ?> 0 Quote Link to comment Share on other sites More sharing options...
Xeron Posted February 28, 2010 Author Share Posted February 28, 2010 (edited) Well if I have made the order in the admin then set the registrar to none and made sure send to registrar is selected, I click on accept order. But the hook doesn’t do anything. I now have edited the hook to your test hook, but it doesn’t do anything it just goes on as normally Edited February 28, 2010 by Xeron 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 28, 2010 Share Posted February 28, 2010 You have a PM with my contact details. I am willing to take a look. 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.