Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560

    semplice problema per inserire frase

    codice:
    /* Perform the Whois query. */
    if ($Domain != '') {
    
      /* If no server was specified then automatically determine. */
      if ($Server == '--automatic--') {
        $Server = 'whois.internic.net';
        $a = explode(".",$Domain);
        if (($a[0] > 0) && ($a[0] < 256) && ($a[3] > 0) && ($a[3] < 256)) {
          $Server = 'whois.arin.net';
          }
        for ($i = 0; $i < sizeof($Servers); $i++) {
          if (ereg($Servers[$i][0],$Domain,$a)) {
            $Server = $Servers[$i][1];
            break;
            }
          }
        }
    
      /* Send the query to the server. */
      echo 'Sending query "' . htmlentities($Domain) . '" to server "' .
        htmlentities($Server) . '":
    ' . "\n";
      $time_start = getmicrotime();
      $Raw = RawWhois($Domain,$Server,$Debug);
      $time_end = getmicrotime();
      echo strlen($Raw) . ' bytes, ' . ($time_end - $time_start) . ' seconds
    ' . "\n";
    
      /* Scan the answer for a redirect. If found then send the query again
         to the server named in the redirect. */
      $Redirect = '';
      if (stristr($Raw,'Asia Pacific Network Information Center ') !== FALSE) {
        $Redirect = 'whois.apnic.net';
        }
      if ((stristr($Raw,'European Regional Internet Registry/RIPE NCC') !== FALSE) ||
          (stristr($Raw,'Allocated to RIPE NCC') !== FALSE)) {
        $Redirect = 'whois.ripe.net';
        }
      if (ereg("   Whois Server: ([0-9A-Za-z\._-]*)",$Raw,$a)) {
        $Redirect = $a[1];
        }
      if (ereg("ReferralServer: ([0-9A-Za-z\._/:-]*)",$Raw,$a)) {
        $Redirect = $a[1];
        if (substr($Redirect,0,8) == 'whois://') $Redirect = substr($Redirect,8);
        }
      if ($Redirect != '') {
        echo 'Redirected to: ' . $Redirect . '
    ' . "\n";
        $RawOriginal = $Raw;
        echo 'Sending query "' . $Domain . '" to server "' . $Redirect . '":
    ' . "\n";
        $time_start = getmicrotime();
        $Raw = RawWhois($Domain,$Redirect,$Debug);
        $time_end = getmicrotime();
        echo strlen($Raw) . ' bytes, ' . ($time_end - $time_start) . ' seconds
    ' . "\n";
        }
    Al posto di Sending query "' . htmlentities($Domain) . '" to server "' ecc ecc... vorrei inserire una frase quando il dominio risulta occupato.. come si può fare?
    grazie

  2. #2
    Per ogni estensione di dominio (.it, .com, .org etc.) il whois a cui fai fare la ricerca (whois.nic.it etc. ) processa una frase tipica nel caso che il dominio è libero (es. No entries found, FREE etc.).
    Pertanto , quando l'avevo fatto io cercavo quella frase, e se veniva matchata indicavo dominio Libero, viceversa Occupato.

    Lo script è un po' datato però rende l'idea: (è solo un estratto)
    Eccolo:

    <form method="POST" action= "">
    <tr><td width="463">
    <span class="text">Verifica se il dominio che vuoi registrare è libero</span>
    <? if ($dominio!=""){ ?>

    <span class="text">Dominio selezionato:<? echo $dominio.".".$ext ?></span>
    <? } ?>


    <?php
    $dominio = strtolower(trim($dominio));
    if ($dominio !=""){
    $dominio=$dominio.".".$ext;
    /*
    Il dominio di secondo livello sui cui desideriamo ricavare informazioni,
    notare l'assenza di "WWW"
    */
    //$dominio ='websiteeb.com' ;
    switch($ext)
    {
    case "it":
    $whois = "whois.nic.it";
    $testo_match="No entries found";
    break;
    case "eu":
    $whois = "whois.eu";
    $testo_match="FREE";
    break;
    case "com":
    $whois = "whois.crsnic.net";
    $testo_match="No match for";
    break;
    case "net":
    $whois = "whois.crsnic.net";
    $testo_match="No match for";
    break;
    case "org":
    $whois = "whois.publicinterestregistry.net";
    $testo_match="NOT FOUND";
    break;
    case "cn":
    $whois = "whois.cnnic.net.cn";
    $testo_match="no matching record";
    break;
    case "cc":
    $whois = "whois.nic.cc";
    $testo_match="No match";
    break;
    case "co.uk":
    $whois = "whois.nic.uk";
    $testo_match="No match";
    break;
    case "org.uk":
    $whois = "whois.nic.uk";
    $testo_match="No match";
    break;
    case "ca":
    $whois = "whois.cira.ca";
    $testo_match="AVAIL";
    break;
    case "us":
    $whois = "whois.nic.us";
    $testo_match="Not found:";
    break;
    case "name":
    $whois = "whois.nic.name";
    $testo_match="No match";
    break;
    case "fr":
    $whois = "whois.nic.fr";
    $testo_match="No entries found";
    break;
    case "nl":
    $whois = "whois.domain-registry.nl";
    $testo_match="is free";
    break;
    case "tv":
    $whois = "whois.www.tv";
    $testo_match="Whois information is not available for domain";
    break;
    }
    /*
    l'host del servizio
    */

    $info = '' ;

    /*
    La connessione
    */
    $sk=fsockopen($whois, 43, $errno, $errstr, 30) or die('Connessione impossibile') ;

    /*
    Inviamo la request
    */
    fputs ($sk, $dominio."\r\n") or die('Request impossibile') ;

    /*
    Leggiamo il response
    */
    while (!feof($sk)) {

    $info.= fgets ($sk, 2048);

    }

    /*
    Output con le informazioni ricavate
    */
    $libero=strpos($info,$testo_match);
    if (!$libero){
    echo "<span class=\"evidenzia\">Dominio già registrato!</span>";
    }else{
    echo "<span class=\"evidenzia\">Dominio Libero:</span>";
    echo " <a href=\"ordina.php?dominio=$dominio\" class=titblu1>Ordina</a>";
    }
    ?>
    </td>
    </tr>
    <tr><td width="463">
    <?
    echo('<pre>'.$info.'</pre>') ;
    ?>
    </td>
    </tr>
    <?
    };
    ?>

    </FORM>

  3. #3
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    ciao federika grazie.. l ho messo on line ma: http://esempio.altervista.org/whois.php

    come mai ?

  4. #4
    quello è solo un estratto , dev'essere adattato al tuo script ; era solo per comprendere il principio da seguire.

    Il dominio ($dominio=$dominio.".".$ext
    dev'essere già passato come variabile.

  5. #5
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    ciao, mi aiuti ad adattarlo? grazie..

  6. #6
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    questo:

    codice:
    <? if ($Domain!=""){ ?>
    
    <span class="text">Dominio selezionato: <? echo $Domain.".".$ext ?></span>
    <? } ?>
    non va..non leggo nulla nel browser..chi mi da una mano ?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.