I have a a script that search whois and give respond if a domain is free or not. The problem is that im only able to search one domain a time, Works digitalpoint.com Not working digitalpont.com digitalpoint.com How do i do to make is search several domains?
I did try but couldnt find how to input it in right way. Maybe you could help me with it? Its a really short code so should be easy for some one who knows.
There you have it. <?php 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 "<div>$domain - Available</div>"; } else echo "<div>$domain - Taken</div>"; } ?> Search <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain" id="domain"> <textarea name="domainname" id="comment" cols="50%" rows="10" tabindex="4"></textarea> <br /> <input type="checkbox" name="all"/>All <input type="checkbox" name="com" checked />.com <input type="checkbox" name="net"/>.net <input type="checkbox" name="org"/>.org <br/> <input class="text" type="submit" name="submitBtn" value="Search"/> </form> <?php if (isset($_POST['submitBtn'])){ $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : ''; $d_all = (isset($_POST['all'])) ? 'all' : ''; $d_com = (isset($_POST['com'])) ? 'com' : ''; $d_net = (isset($_POST['net'])) ? 'net' : ''; $d_org = (isset($_POST['org'])) ? 'org' : ''; // Check domains only if the base name is big enough if (strlen($domainbase)>0){ ?> <br /> <strong>Searched domains</strong> <div id="result"> <?php if (($d_com != '') || ($d_all != '') ) showDomainResult($domainbase.".com",'whois.crsnic.net','No match for'); if (($d_net != '') || ($d_all != '') ) showDomainResult($domainbase.".net",'whois.crsnic.net','No match for'); if (($d_org != '') || ($d_all != '') ) showDomainResult($domainbase.".org",'whois.publicinterestregistry.net','NOT FOUND'); ?> </div> </div> <?php } } ?> </body> PHP: