Foros del Web » Programando para Internet » ASP Clásico »

Whois para .MX - APORTACION

Estas en el tema de Whois para .MX - APORTACION en el foro de ASP Clásico en Foros del Web. Por si a alguien le sirve hice un checador de whois para dominios .com.mx, .net.mx y .org.mx por si a alguien le sirve, es una ...
  #1 (permalink)  
Antiguo 29/05/2005, 20:28
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 5 meses
Puntos: 16
Whois para .MX - APORTACION

Por si a alguien le sirve hice un checador de whois para dominios .com.mx, .net.mx y .org.mx por si a alguien le sirve, es una adaptacion de uno que con sultaba los normales (sin mx)
Solo enviale el dominio en la variable domain y extension en la variable suffix via query
Se podria adaptar para mas tipos de dominios aparte de los mencionados, pero creo que puse los mas usados

Código:
<% 
'Poner tiempo de espera a 90seg
Server.ScriptTimeout = 90

'Whois function to query the whois server
Private Function whoisResult(whoisURL, strMethod, strResultsStart, strResultsEnd)

	'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 = "No Valido - debe tener por lo menos 3 caracteres"
			
	'Else if there is an error
		ElseIF InStr(1, strWhoisResultString, "Error", vbTextCompare) Then
			
			'Set the return result of the function to Taken
			whoisResult = "A ocurrido un error"
			
		'Else there was a result
		Else
			
			'Strip the whois result leaving the data we want
		    whoisResult = resultFormater(strWhoisResultString, strResultsStart, strResultsEnd)
		End If
		
		'Clean up
		Set objXMLHTTP = Nothing
End Function


'Function to strip all non estential returned input
Private Function resultFormater(strWhoisResultString, strResultsStart, strResultsEnd)

	'Dimension variables
	Dim lngResultsStartPos
	Dim lngResultsEndPos

	'Find the start position in the returned data of the result
	lngResultsStartPos = InStr(1, strWhoisResultString, strResultsStart, 1) + Len(strResultsStart)
		    		    		    		    		    		
	'Find the end position in the returned data of the result
	lngResultsEndPos = InStr(lngResultsStartPos, strWhoisResultString, strResultsEnd, 1)
						
	'Make sure the end position is not in error
	If lngResultsEndPos - lngResultsStartPos =< Len(strResultsStart) Then lngResultsEndPos = lngResultsStartPos + Len(strResultsStart)
			
	'Now we know the start and end position of the result, strip the rest and return the result
	resultFormater = Trim(Mid(strWhoisResultString, lngResultsStartPos, (lngResultsEndPos - lngResultsStartPos)))	
End Function


'Function to strip non alphanumeric characters
Private Function characterStrip(strTextInput)

	'Dimension variable
	Dim intLoopCounter 	'Holds the loop counter
	
	'Loop through the ASCII characters up to - hyphen
	For intLoopCounter = 0 to 44
		strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0) 
	Next
	
	'Loop through the ASCII characters from hyphen to numeric charcaters
	For intLoopCounter = 46 to 47
		strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0) 
	Next
	
	'Loop through the ASCII characters numeric characters to lower-case characters
	For intLoopCounter = 58 to 96
		strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0) 
	Next
	
	'Loop through the extended ASCII characters
	For intLoopCounter = 123 to 255
		strTextInput = Replace(strTextInput, CHR(intLoopCounter), "", 1, -1, 0) 
	Next
	
	'Return the string
	characterStrip = strTextInput
	
End Function



'Dimension variables
Dim strDomainName	'Holds the domain name to search for
Dim strSuffix		'Holds the domain name suffix to search

'Read in the domain name to search

'If a domain name has been entred then strip any unwanted characters from it
If strDomainName <> "" Then
	
	'Convert the domain name to check to lower case
	strDomainName = LCase(strDomainName)
	
	'Remove www and http from in front
	strDomainName = Replace(strDomainName, "http://", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, "www.", "", 1, -1, 1)
	
	'Remove suffixes
	strDomainName = Replace(strDomainName, ".com", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".net", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".org", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".info", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".biz", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".tv", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".name", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".co.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".org.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".ltd.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".plc.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".net.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".me.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".pn.uk", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".com.mx", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".net.mx", "", 1, -1, 1)
	strDomainName = Replace(strDomainName, ".org.mx", "", 1, -1, 1)

	'Remove any hyphens from the first and last characters
	If Left(strDomainName, 1) = "-" Then strDomainName = Mid(strDomainName, 2, Len(strDomainName))
	If Right(strDomainName, 1) = "-" Then strDomainName = Mid(strDomainName, 1, Len(strDomainName)-1)

	'Remove any hyphens double hyphens
	strDomainName = Replace(strDomainName, "--", "-", 1, -1, 1)
	
	'Strip all non aphanumeric characters from the input
	strDomainName = characterStrip(strDomainName)
End If

'If a domain name is enterd check it
If strDomainName <> "" Then
	Response.Write("<pre>")	
	
	'Display the avialbility
	Response.Write("<b>Resultados de la busqueda de<br> www." & strDomainName & strSuffix & "</b><br><br>")
			 
	'Call the domain checking function depending on domain suffix
	
	If strSuffix = ".com" Then 
	    Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".com&type=domain", "GET", "<pre>", "</pre>"))
		
	'check for .net
	ElseIf strSuffix = ".net" Then 
	    Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".net&type=domain", "GET", "<pre>", "</pre>"))
	
	'Check for .org	
	ElseIf strSuffix = ".org" Then 
	    Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".org&type=domain", "GET", "<pre>", "</pre>"))
	
	'Check for .biz	
	ElseIf strSuffix = ".biz" Then 
	    Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".biz&type=domain", "GET", "<pre>", "</pre>"))
	
	'Check for .info	
	ElseIf strSuffix = ".info" Then 
	    Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".info&type=domain", "GET", "<pre>", "</pre>"))	

	ElseIf strSuffix = ".com.mx" Then 
	    Response.Write(whoisResult("http://www.nic.mx/es/Busqueda.Who_Is_3?domain_name="&strDomainName&"&domain_type=1&template_type=&object_type_1=&object_type_2=&object_type_3=3&text="& strDomainName &"&current_page=Busqueda.Who_Is_2", "GET", "<pre style=""font-size: 14px; margin-left: 10px;"">", "</pre>"))	
	ElseIf strSuffix = ".net.mx" Then 
	    Response.Write(whoisResult("http://www.nic.mx/es/Busqueda.Who_Is_3?domain_name="&strDomainName&"&domain_type=3&template_type=&object_type_1=&object_type_2=&object_type_3=3&text="& strDomainName &"&current_page=Busqueda.Who_Is_2", "GET", "<pre style=""font-size: 14px; margin-left: 10px;"">", "</pre>"))	
	ElseIf strSuffix = ".org.mx" Then 
	    Response.Write(whoisResult("http://www.nic.mx/es/Busqueda.Who_Is_3?domain_name="&strDomainName&"&domain_type=5&template_type=&object_type_1=&object_type_2=&object_type_3=3&text="& strDomainName &"&current_page=Busqueda.Who_Is_2", "GET", "<pre style=""font-size: 14px; margin-left: 10px;"">", "</pre>"))	
	End If  

	'Finish the red span tag
	Response.Write("</pre>")	
End If	   
%>
__________________
CreandoWebs.com
www.creandowebs.com
PLANTILLAS TEMPLATEMONSTER CON 10% DE DESCUENTO
  #2 (permalink)  
Antiguo 30/05/2005, 11:14
Avatar de trasgukabi  
Fecha de Ingreso: septiembre-2004
Mensajes: 2.749
Antigüedad: 19 años, 9 meses
Puntos: 18
y porqué no lo pones en la bibloteca de funciones? es interesante...
  #3 (permalink)  
Antiguo 30/05/2005, 18:03
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 5 meses
Puntos: 16
lo puse en las FAQs
  #4 (permalink)  
Antiguo 08/12/2009, 00:14
 
Fecha de Ingreso: octubre-2006
Mensajes: 31
Antigüedad: 17 años, 7 meses
Puntos: 0
Respuesta: Whois para .MX - APORTACION

hola, me interesa este aporte pero mi duda es como puedo utilizarlo en mi sitio web, o mas bien como es el proceso de instalacion

gracias
  #5 (permalink)  
Antiguo 08/12/2009, 14:47
 
Fecha de Ingreso: octubre-2009
Mensajes: 97
Antigüedad: 14 años, 7 meses
Puntos: 4
Respuesta: Whois para .MX - APORTACION

Yo tengo aquí otro buscador de dominios. No contacta a ninguna página externa, solo trata de acceder al sitio, y si no lo encuentra, aparece el dominio libre.

Código asp:
Ver original
  1. <html><title>Buscador de dominios</title><body>
  2. <%
  3. tipico="msxml2.xmlhttp"     'El objeto "tipico"
  4. function disponible(dominio)
  5. set xml=server.createobject(tipico)   'Creamos el objeto
  6.  
  7. if checar_conexion_internet=false then     'Checamos si el usuario tiene conexión a internet
  8. disponible="No existe conexión a internet."
  9. else
  10.  
  11. xml.open "GET","http://"&dominio,false  'Enviamos la solicitud
  12. if "www."=left(lcase(dominio),4) then dominio=right(dominio,len(dominio)-4)
  13. on error resume next
  14. xml.send
  15. if err.description="" then   'Si el objeto xml devuelve un error, quiere decir que no encontro el dominio en la web y esta libre
  16. disponible="El dominio <b>"&dominio&"</b> esta ocupado.<br><a href='http://"&dominio&"' target=_blank>Link a la página</a>"
  17. else
  18. disponible="El dominio <b>"&dominio&"</b> esta libre.<br><a href='http://www.superhosting.cl/dominios/dominios2.php?dominio="&server.urlencode(dominio)&"' target=_blank>Comprar</a>"
  19. end if
  20. end if
  21. end function
  22.  
  23. function checar_conexion_internet
  24. set xml=server.createobject(tipico)
  25. xml.open "get","http://www.sitio.com",false   'Abrimos www.sitio.com. Con esta pagina, comprobaremos la conexion a internet
  26. on error resume next  'Si hay un error, no hay conexion a internet
  27. xml.send
  28. if err.description="" then estado=true else estado=false end if
  29. checar_conexion_internet=estado
  30. end function
  31. %>
  32. <form action="?checar=true" method=post>
  33. Escriba el dominio a checar sin <b>http://</b>:<br>
  34. <input type=text name=dominio value="<%=request("dominio")%>"><br>
  35. <input type=submit value="Checar">
  36. </form>
  37. <%
  38. if request("checar")="true" then
  39. %>
  40. <%="<hr>"&disponible(request("dominio"))%>
  41. <%end if%>
  42. </body></html>

Espero que les sirva de algo.
  #6 (permalink)  
Antiguo 09/12/2009, 19:23
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 5 meses
Puntos: 16
Respuesta: Whois para .MX - APORTACION

la cosa es que el dominio puede estar registradoy no apuntar a ninguna pagina... por lo que quizas no sea tan funcional
__________________
CreandoWebs.com
www.creandowebs.com
PLANTILLAS TEMPLATEMONSTER CON 10% DE DESCUENTO
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:03.