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

Código para lookup en asp

Estas en el tema de Código para lookup en asp en el foro de ASP Clásico en Foros del Web. Hola a todos, Si alguien tiene un código para hacer lookup (verificar disponibilidad de dominios) en asp, se los agradecería o si tienen algunos links ...
  #1 (permalink)  
Antiguo 12/08/2005, 13:46
Avatar de eastdev  
Fecha de Ingreso: enero-2004
Ubicación: Caracas
Mensajes: 52
Antigüedad: 20 años, 4 meses
Puntos: 0
Pregunta Código para lookup en asp

Hola a todos,

Si alguien tiene un código para hacer lookup (verificar disponibilidad de dominios) en asp, se los agradecería o si tienen algunos links para guiarme.

Gracias de antemano...

Eduardo A. Sojo T.
Caracas-Venezuela
  #2 (permalink)  
Antiguo 12/08/2005, 14:43
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 21 años, 7 meses
Puntos: 16
eso lo conocia con otro nombre no recuerdo cual pero en las faqs o en las librerias hay un ejemplo... ademas en www.webwizguide.com hay uno Whois creo que se llaman???? eso saludos y suerte
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
  #3 (permalink)  
Antiguo 13/08/2005, 10:35
Avatar de eastdev  
Fecha de Ingreso: enero-2004
Ubicación: Caracas
Mensajes: 52
Antigüedad: 20 años, 4 meses
Puntos: 0
Hola, gracias por la información. El de www.webwizguide.com no funciona... se llama lookup al que sólo te comprueba si el dominio está disponible o no; en cambio el whois es el que te trae la información de ese dominio (Contacto técnico, de facturación, sus dns....)

Gracias de todas formas,
__________________
| Eduardo A. Sojo T. | [email protected] |
  #4 (permalink)  
Antiguo 13/08/2005, 11:37
Avatar de El_Metallick  
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 21 años, 7 meses
Puntos: 16
a ok gracias por la aclaracion... bueno pero si no es asi no sabria decirte... pusca en hotscripts ahi deve haber uno.. saludos
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!
  #5 (permalink)  
Antiguo 13/08/2005, 13:07
Avatar de sjam7  
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 5 meses
Puntos: 16
Bueno, entonces es lo mismo que el whois solo que tu seleccionas que informacion quieres que salga en caso de un resultado, te paso esto que seria lo que necesitas (espero):
Este checa tambien dominios .MX

Código:
<%
bde=request.querystring("bde")
domain=request.querystring("domain")
suffix=request.querystring("suffix")
submit=request.querystring("submit")

'Pone el ScriptTimeout en 90
Server.ScriptTimeout = 90

'Funcion Whois
Dim esta
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 = "No Valido - debe tener por lo menos 3 caracteres"
		
		'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 = "Disponible"
 			esta = "Disponible"
			
		'Else if there is an error
		ElseIF InStr(1, strWhoisResultString, "Error", vbTextCompare) Then
			
			'Si ocurre algun error
			whoisResult = "A ocurrido un error"
			
		Else
			
			'Resultado si No esta disponible
			whoisResult = "No disponible"
		End If
	  
		'Clean up
		Set objXMLHTTP = Nothing
		
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
strDomainName = Trim(Request.QueryString("domain"))
strSuffix = Trim(Request.QueryString("suffix"))
'if not instr(1,strsuffix,".") then strsuffix="."&suffix

'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, ".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
	
	'Display the avialbility
	Response.Write("<b>www." & strDomainName & strSuffix & " esta<br><font color=""color: #FF0000;"">")
			 
	'Call the domain checking function depending on domain suffix
	
	If strSuffix = ".us" Then   
	 Response.Write(whoisResult("http://www.whois.us/whois.cgi?TLD=us&WHOIS_QUERY=" & strDomainName & "&TYPE=DOMAIN", "GET", "no records"))
	
	'Check for .com
	ElseIf strSuffix = ".com" Then 
	 Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".com&type=domain", "GET", "No match"))
		
	'check for .net
	ElseIf strSuffix = ".net" Then 
	 Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".net&type=domain", "GET", "No match"))
	
	'Check for .org	
	ElseIf strSuffix = ".org" Then 
	 Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".org&type=domain", "GET", "NOT FOUND"))
	
	'Check for .biz	
	ElseIf strSuffix = ".biz" Then 
	 Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".biz&type=domain", "GET", "Not found"))
	
	'Check for .info	
	ElseIf strSuffix = ".info" Then 
	 Response.Write(whoisResult("http://www-whois.internic.net/cgi/whois?whois_nic=" & strDomainName & ".info&type=domain", "GET", "NOT FOUND"))	

	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", "No Encontradas"))	

	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", "No Encontradas"))	

	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", "No Encontradas"))	
	End If  
	
	'Finsh the red span tag
	Response.Write("</font></b>")	
End If	   
			%>
			<br>
			<br>
			<%
if esta = "Disponible" then
response.write "El dominio "&strDomainName&" esta DISPONIBLE"
end if
%>
A este codigo le hice unos cambios al vuelo por si no funciona me avisas, pero antes dale una leida y checada, no me vayas a preguntas cosas nomas por no leer

Para que este funcione tienes que enviarle la informacion desde un formulario con los campos:
domain Obviamente es el dominio sin extencion
suffix Es la extencion

EL codigo lo toma desde query por lo que si lo mandas desde un formulario usa el metodo GET

Espero te sirva, ademas te aviso que es el mismo codigo de WebWizGuide que dices que no te sirvio solo con algunas pequeñas modificaciones que le hice

saludos
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 22:13.