Witam.

Mam skrypt, który działa i wyświetla wolne domeny. Wszystko działa tylko niezbędne jest przeładowanie strony www.
Jak to przerobić, żeby działało w AJAX'ie? - potrzebuję gotowego rozwiązania...
Poniżej daję kod php, który działa perfekcyjnie:

  1. <HEAD>
  2. <META NAME="konwerter" CONTENT="Ogonki97 1.3">
  3. <META HTTP-EQUIV="content-type" CONTENT="text/html; CHARSET=iso-8859-2">
  4. <script src="google_ga.js" type="text/javascript"></script>
  5. </HEAD>
  6. <div id="TRESC">
  7. <?php
  8. function checkDomain($domain,$server,$findText){
  9. // Open a socket connection to the whois server
  10. $con = fsockopen($server, 43);
  11. if (!$con) return false;
  12.  
  13. // Send the requested doman name
  14. fputs($con, $domain."\r\n");
  15.  
  16. // Read and store the server response
  17. $response = ' :';
  18. while(!feof($con)) {
  19. $response .= fgets($con,128);
  20. }
  21.  
  22. // Close the connection
  23. fclose($con);
  24.  
  25. // Check the response stream whether the domain is available
  26. if (strpos($response, $findText)){
  27. return true;
  28. }
  29. else {
  30. return false;
  31. }
  32. }
  33.  
  34. function showDomainResult($domain,$server,$findText){
  35. if (checkDomain($domain,$server,$findText)){
  36. echo "<tr><td>$domain</td><td><B>DOSTĘPNA<B></td></tr>";
  37. }
  38. else echo "<tr><td>$domain</td><td>ZAJĘTA</td></tr>";
  39. }
  40. ?>
  41.  
  42. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
  43. <html>
  44. <head>
  45. <title>MicroWhois domain checker</title>
  46. <link href="whois_style.css" rel="stylesheet" type="text/css" />
  47. </head>
  48. <body>
  49. <div id="main">
  50. <div id="caption">SPRAWDZENIE WOLNEJ DOMENY</div>
  51. <div id="icon">&nbsp;</div>
  52. <form action="" method="post" name="domain" id="domain">
  53. Nazwa domeny:
  54. <table>
  55. <tr><td><input class="text" name="domainname" type="text" size="36"/></td></tr>
  56. <tr>
  57. <td>
  58. <input type="checkbox" name="all" checked />All
  59. <input type="checkbox" name="pl"/>.pl
  60. <input type="checkbox" name="eu"/>.eu
  61. <input type="checkbox" name="com"/>.com
  62. <input type="checkbox" name="net"/>.net
  63. <input type="checkbox" name="org"/>.org
  64. <input type="checkbox" name="info"/>.info
  65. </td></tr>
  66. <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Sprawdź domenę"/></td></tr>
  67. </table>
  68. </form>
  69. <?php
  70. if (isset($_POST['submitBtn'])){
  71. $domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
  72. $d_all = (isset($_POST['all'])) ? 'all' : '';
  73. $d_pl = (isset($_POST['pl'])) ? 'pl' : '';
  74. $d_eu = (isset($_POST['eu'])) ? 'eu' : '';
  75. $d_com = (isset($_POST['com'])) ? 'com' : '';
  76. $d_net = (isset($_POST['net'])) ? 'net' : '';
  77. $d_org = (isset($_POST['org'])) ? 'org' : '';
  78. $d_info = (isset($_POST['info'])) ? 'info' : '';
  79.  
  80. // Check domains only if the base name is big enough
  81. if (strlen($domainbase)>2){
  82. ?>
  83. <div id="caption">WYNIK</div>
  84. <div id="icon2">&nbsp;</div>
  85. <div id="result">
  86. <table width="100%">
  87. <?php
  88. if ( ($d_all != '') ) showDomainResult($domainbase.".eu",'whois.eu','No match for');
  89. if (($d_pl != '') || ($d_all != '') ) showDomainResult($domainbase.".pl",'whois.dns.pl','No information about');
  90. if (($d_com != '') || ($d_all != '') ) showDomainResult($domainbase.".com",'whois.crsnic.net','No match for');
  91. if (($d_net != '') || ($d_all != '') ) showDomainResult($domainbase.".net",'whois.crsnic.net','No match for');
  92. if (($d_org != '') || ($d_all != '') ) showDomainResult($domainbase.".org",'whois.publicinterestregistry.net','NOT FOUND');
  93. if (($d_info != '') || ($d_all != '') ) showDomainResult($domainbase.".info",'whois.afilias.net','NOT FOUND');
  94. ?>
  95. </table>
  96. </div>
  97. <?php
  98. }
  99. }
  100. ?>
  101.  
  102. </div>
  103. </div>
  104.