Witam. Mam problem ze sprawdzeniem dostępności domeny .PL. W sieci jest mnóstwo skryptów typu whois, sprawdziłem każdy jaki znalazłem. Jednak dla domeny .PL każdy skrypt wyrzuca, że domena jest już zajęta, choć w rzeczywistości tak nie jest... Pytanie: co tu nie gra?
  1. <?php
  2. function checkDomain($domain,$server,$findText){
  3. // Open a socket connection to the whois server
  4. $con = fsockopen($server, 43);
  5. if (!$con) return false;
  6.  
  7. // Send the requested doman name
  8. fputs($con, $domain."\r\n");
  9.  
  10. // Read and store the server response
  11. $response = ' :';
  12. while(!feof($con)) {
  13. $response .= fgets($con,128);
  14. }
  15.  
  16. // Close the connection
  17. fclose($con);
  18.  
  19. // Check the response stream whether the domain is available
  20. if (strpos($response, $findText)){
  21. return true;
  22. }
  23. else {
  24. return false;
  25. }
  26. }
  27.  
  28. function showDomainResult($domain,$server,$findText){
  29. if (checkDomain($domain,$server,$findText)){
  30. echo "<tr><td>$domain</td><td>AVAILABLE</td></tr>";
  31. }
  32. else echo "<tr><td>$domain</td><td>TAKEN</td></tr>";
  33. }
  34. ?>
  35.  
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
  37. <html>
  38. <body>
  39. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain">
  40. Domain name:
  41. <table>
  42. <tr><td><input name="domainname" type="text" /></td></tr>
  43. <tr><td><input type="checkbox" name="com" checked/>.pl</td></tr>
  44. <tr><td><input type="submit" name="submitBtn" value="Check domain"/></td></tr>
  45. </table>
  46. </form>
  47. <?php
  48. // The form was submitted
  49. if (isset($_POST['submitBtn'])){
  50. $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
  51. $d_com = (isset($_POST['com'])) ? 'com' : '';
  52.  
  53. // Check domains only if the base name is big enough
  54. if (strlen($domainbase)>2){
  55. echo '<table>';
  56. if ($d_com != '')
  57. showDomainResult($domainbase.".pl",'whois.dns.pl','No information about');
  58. echo '</table>';
  59. }
  60. }
  61. ?>
  62. </body>
Nie zwracajcie uwagi na końcówki "com", pójdzie do edycji jeśli skrypt zadziała jak należy.