Ciao a tutti,
sto facendo uno script per controllare l'esistenza di un dominio.
Mi funziona correttamente per le estensioni it e us.
Non funziona invece per questi domini: come, net, org, info, biz.


Vi posto il codice che uso:
Se conoscete anche un altro script funzionante va benissimo!
grazie
<%Response.Buffer = true%>
<%
strSuffix = request("type")
strDomainName = replace(request("name")," ","")

'Check for .com
If strSuffix = ".com" Then

strReturn=whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & "&type=domain", "GET", "No match")
flag = "internic"

'Check for .net
ElseIf strSuffix = ".net" Then

strReturn=whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & "&type=domain", "GET", "No match")
flag = "internic"

'Check for .org
ElseIf strSuffix = ".org" Then

strReturn=whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & "&type=domain", "GET", "No match")
flag = "internic"

'Check for .info
ElseIf strSuffix = ".info" Then

strReturn=whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & "&type=domain", "GET", "NOT FOUND")
flag = "internic"

'Check for .biz
ElseIf strSuffix = ".biz" Then

strReturn=whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & "&type=domain", "GET", "Not found")
flag = "internic"

'Check for .us
ElseIf strSuffix = ".us" Then

strReturn=whoisResult("http://www.whois.us/whois.cgi?TLD=us&WHOIS_QUERY=" & strDomainName & "&TYPE=DOMAIN", "GET", "no records")
flag = "whois.us"

'Check for .it
ElseIf strSuffix = ".it" Then

strReturn=whoisResult("http://www.ripe.net/perl/whois?searchtext=" & strDomainName & ".it", "GET", "No entries found")
flag = "Ripe"

End If

if strReturn<>"No Result" then
if flag="internic" then

i=instr(1,strReturn,"<pre>")
j=instr(1,strReturn,"</pre>")
strReturn=left(strReturn,j+5)
strReturn=right(strReturn,len(strReturn)-i+5)

elseif flag="whois.us" then

i=instrrev(strReturn,"<pre>")
j=instrrev(strReturn,"</pre>")
strReturn=left(strReturn,j+5)
strReturn=right(strReturn,len(strReturn)-i+1)

elseif flag="Ripe" then

i=instr(1,strReturn,"%REFERRAL START")
j=instr(1,strReturn,"%REFERRAL END")
strReturn=left(strReturn,j-5)
strReturn=right(strReturn,len(strReturn)-i-15)

end if
end if


Private Function whoisResult(whoisURL, strMethod, strCheckString)

'Dimension variables
Dim objXMLHTTP 'Holds the XML HTTP Object
Dim strWhoisResultString 'Holds the reult of the whois query

'Create an XML object to query the remote whois server
'Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

'Alternative XML HTTP component, for version 3.0 of XMLHTTP
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

'Open a connection to the remote whois server
objXMLHTTP.Open strMethod, whoisURL, False

'Send the request and return the data
objXMLHTTP.Send

'Place the whois registry response into the result string
strWhoisResultString = objXMLHTTP.ResponseText

'If the domain name is to short then tell them it's invalid
If Len(strDomainName) < 3 Then

'Set the return result of the function to not valid
whoisResult = "Not Valid - must be at least 3 characters"

'Check the whois result to see if a result has NOT been found
ElseIf InStr(1, strWhoisResultString, strCheckString, vbTextCompare) Then

'Set the return result of the function to available
whoisResult = "No Result"

'Else if there is an error
ElseIF InStr(1, strWhoisResultString, "Error", vbTextCompare) Then

'Set the return result of the function to Taken
whoisResult = "No Result"

'Else there was a result
Else

'Set the return result of the function to Taken
whoisResult = strWhoisResultString

End If

'Clean up
Set objXMLHTTP = Nothing

End Function%>