Jump to content

Add WHOIS in new domain searches


Recommended Posts

Regards,

this time I leave you a small script that we did for my company a few months ago to add the whois (see domain information) to whmcs.

I clarify that I did not see this published anywhere, this was an old whmcs function, but for some reason it was removed in the new versions, in theory it was something we came up with to do for https://cangurohosting.com.


To explain a bit, the operation is based on using the WHMCS own api to perform the whois. The code works perfectly with the default whmcs template. if you want to add it in a custom template it should work fine in your template, and if that is not the case then you need to fix it on your own for your own whmcs.


DEMO:  

 

To implement, you simply create the file verificar-whois.php in the root directory of your whmcs installation.

verificar-whois.php

<?php
require_once 'init.php';
$dominio = $_POST['dominio'];
$command = 'DomainWhois';
$postData = array('domain' => $dominio);
$results = localAPI($command, $postData);
$whois = $results["whois"];
echo '<pre style="overflow: unset !important;font-size: 11px !important;text-align: left; white-space: normal;">' . $whois . '</pre>';
?>

 

Then go to the active template of your shopping cart in use:

/templates/orderforms/standard_cart

Open file: domainregister.tpl

Find the line with the following content:

{lang key='orderForm.domainIsUnavailable'

You must comment or remove this entire line of code:

<p class="domain-unavailable domain-checker-unavailable">{lang key='orderForm.domainIsUnavailable'}</p>

Then you should paste the following code below:

 <p class="domain-unavailable domain-checker-unavailable alert alert-danger"><strong>{lang key='orderForm.domainIsUnavailable'} </strong> no está disponible

<a href="#WhoisModal" class="BotonSolicitarWhoisOpenModal btn-danger btn-sm btn">Ver Información (Whois) de este dominio.</a>
<script>
var elDominio = "";
setInterval(function(){
if(         $('div#DomainSearchResults div#searchDomainInfo.domain-checker-result-headline div#primaryLookupResult.domain-lookup-result p.domain-unavailable.domain-checker-unavailable.alert.alert-danger').is(":visible") ) {
elDominio = $('div#DomainSearchResults div#searchDomainInfo.domain-checker-result-headline div#primaryLookupResult.domain-lookup-result p.domain-unavailable.domain-checker-unavailable.alert.alert-danger strong')[0].innerHTML;
}
}, 100);
/* buscar boton modal */
$( ".BotonSolicitarWhoisOpenModal" ).click(function() {
$('.InfoHeader-Whois').html(elDominio);
$("#WhoisModal").modal("show");
$.ajax({
           url: '/verificar-whois.php',
            type: 'post',
            async: true,
            crossDomain: true,
            data: {
            dominio: elDominio
            },
            success: function( data, response){
            $('.DatosWhois').html( data );
                }
});
// by cangurohosting.com
});
</script>
  <!-- Modal -->
  <div class="modal fade" id="WhoisModal" role="dialog">
    <div class="modal-dialog">
     <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header" style="text-align: left !important;">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title" >Informacion WHOIS para el dominio: <span class="InfoHeader-Whois"></span></h4>
        </div>
        <div class="modal-body">
          <div class="DatosWhois"><div class="loader-whois"></div> <span>Cargando..</span></div>
        </div>
        <div class="modal-footer" style="text-align: right !important;">
          <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
        </div>
      </div>
    </div>
  </div>

the code has some paragraphs in Spanish, you can edit as you like.

I hope you serve them and they like it.

Sorry if my English is not very good. 🙂 I hope you understand me.

Link to comment
Share on other sites

  • 6 months later...

Nicely done mate! indeed very useful, for the other guys:
 

Cerrar - Close

informacion WHOIS para el dominio - WHOIS information for the domain

Cargando.. - Loading..

no esta disponible - is not available

Ver informacion de este dominio - View information about this domaib

 

Link to comment
Share on other sites

17 hours ago, Biswas Host Ltd said:

I think it should be a default function of WHMCS.  Because every domain company need this function for their client.

i'd be wary of using it if you sell a TLD that has very strict whois lookup limits - cos wasting whois lookups on this could prevent accurate results for those wanting to register a domain using that TLD.

Link to comment
Share on other sites

24 minutes ago, JesusSuarz said:

If you look at the code carefully, you'll see that it only runs when the domain is not available.

that doesn't really matter - if I ran a Dutch site, where port43 .nl lookups might be limited to 15 per day, and i'm wasting one each time by someone looking up the whois of an existing .nl domain, then it's one less available to someone who might want to register a .nl domain (assuming standard_whois is being used for domain searches in the cart).

32 minutes ago, JesusSuarz said:

also I have tested this with the domain suggestions and it works perfectly.

like ptomter, I can't get it working at all on my v8.1 dev.

Link to comment
Share on other sites

1 minute ago, brian! said:

that doesn't really matter - if I ran a Dutch site, where port43 .nl lookups might be limited to 15 per day, and i'm wasting one each time by someone looking up the whois of an existing .nl domain, then it's one less available to someone who might want to register a .nl domain (assuming standard_whois is being used for domain searches in the cart).

like ptomter, I can't get it working at all on my v8.1 dev.

you can see it working on my whmcs 8.0.4 https://cangurohosting.com/dash/cart.php?a=add&domain=register

if you are using whmcs in a folder you must check the url: '/verify-whois.php', 

in my case it is: url: '/dash/verify-whois.php',

You must also verify that the chain of the classes in the javascript "elDominio" and the above are correct according to your template.

here I leave a video: https://www.loom.com/share/5aee770fb7984616bd3eb4f7401814d3

 

Link to comment
Share on other sites

15 minutes ago, brian! said:

that doesn't really matter - if I ran a Dutch site, where port43 .nl lookups might be limited to 15 per day, and i'm wasting one each time by someone looking up the whois of an existing .nl domain, then it's one less available to someone who might want to register a .nl domain (assuming standard_whois is being used for domain searches in the cart).

like ptomter, I can't get it working at all on my v8.1 dev.

in this case the problem is not about my code.

if not on the whois server for .nl domains then the administrators of the whois server of the .nl domains should to allow more requests per day.

I find it absurd that they only allow 15 searches a day.

Link to comment
Share on other sites

28 minutes ago, JesusSuarz said:

you can see it working on my whmcs 8.0.4 https://cangurohosting.com/dash/cart.php?a=add&domain=register

oh I don't doubt it works for you on your site, but I can't get it working locally in v8 or v8.1 - not to worry, I give up trying to make it work.... posted code really needs to work with no more than a copy&paste....

btw - you should replace the text where you can with language strings - cargando and cerrar will have existing client strings available to use.

15 minutes ago, JesusSuarz said:

in this case the problem is not about my code.

no - but it could contribute to a problem is a site owner uses it.

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.

×
×
  • 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