Jump to content

Action hook Hi, PreDomainRegister


Xeron

Recommended Posts

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 :S

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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");
?>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by m00
Link to comment
Share on other sites

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 = "";
}

Link to comment
Share on other sites

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 by m00
Link to comment
Share on other sites

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 :S

Edited by Xeron
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated