Provjera domena

Pozdrav svima. Zanima me kako da napravim provjeru .hr i com.hr domene.

Uspio sam napravit za većinu:

<?php
//don't allow other scripts to grab and execute our file
defined('_JEXEC') or die('Direct Access to this location is not allowed.');

    function checkDomain($domain,$server,$findText){
        // Open a socket connection to the whois server
        $con = fsockopen($server, 43);
        if (!$con) return false;
      
        // Send the requested doman name
        fputs($con, $domain."\r\n");
      
        // Read and store the server response
        $response = ' :';
        while(!feof($con)) {
            $response .= fgets($con,128); 
        }
      
        // Close the connection
        fclose($con);
      
        // Check the response stream whether the domain is available
        if (strpos($response, $findText)){
            return true;
        }
        else {
            return false; 
        }
    }
  
    function showDomainResult($domain,$server,$findText){
       if (checkDomain($domain,$server,$findText)){
          echo "<tr><td>$domain</td><td>&nbsp;je dostupna</td></tr>";
       }
       else echo "<tr><td>$domain</td><td>&nbsp;je zauzeta</td></tr>";
    }
?>

      <form action="" method="post" name="domain">
        Upišite ime domene:
		<input name="domainname" type="text" />
		<div class="cleaner"></div>
        <input type="checkbox" name="com"/>.com
        <input type="checkbox" name="net"/>.net
        <input type="checkbox" name="info"/>.info
        <div class="cleaner"></div>
        <input type="submit" name="submitBtn" value="Provjera"/>
       
      </form>
<?php  
    // The form was submitted
    if (isset($_POST['submitBtn'])){
        $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
        $d_com      = (isset($_POST['com'])) ? 'com' : '';  
        $d_net      = (isset($_POST['net'])) ? 'net' : '';
        $d_info     = (isset($_POST['info'])) ? 'info' : '';
        $d_all       = (isset($_POST['all'])) ? 'all' : '';
      
        // Check domains only if the base name is big enough
        if (strlen($domainbase)>2){
            echo '<table>';
            if ($d_com != '' || $d_all != '')
               showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
            echo '</table>';
        }
        if (strlen($domainbase)>2){
            echo '<table>';
            if ($d_net != '' || $d_all != '')
               showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
            echo '</table>';
        }
      
        if (strlen($domainbase)>2){
            echo '<table>';
            if ($d_info != '' || $d_all != '')
               showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND');
            echo '</table>';
        }
    }
?> 

Ovo je dio koda al na taj naćin funkcionira, i sad ne znam kako da ubacim za .hr i com.hr domenu. pokušao sam sa whois.com.hr ali tada skripta samo učitava ali ništa ne ispiše. možda je krivi conection… Ubiti ako netko zna bio bih zahvalan.

Kaj nitko ne zna??? Ili barem di se to da nać ištaaaa :frowning:


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Webmaster.Ninja