
12/08/2002, 09:03
|
| | Fecha de Ingreso: agosto-2002
Mensajes: 8
Antigüedad: 22 años, 10 meses Puntos: 0 | |
Re: Capturar titulo de Pagina <% function buscar (url,tagin,tagout)
'Response.Buffer = True'
Dim objXMLHTTP, xml, texto,inicio,final,longitud,texto2
' Create an xmlhttp object:'
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Or, for version 3.0 of XMLHTTP, use:'
'Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP&quo t;)'
xml.Open "GET", url, False
xml.Send
texto=xml.ResponseText
texto2=Ucase(texto)
tagin=Ucase(tagin)
tagout=Ucase(tagout)
inicio=instr(texto2,tagin)
texto2= Mid(texto,inicio + len(tagin))
texto3= Ucase(texto2)
final=instr(texto3,tagout)
Response.Write left(texto2, final - 1)
Set xml = Nothing
end function
Response.Write buscar("http://www.terra.es","<META NAME=""description"" CONTENT="","">")
Ahi está la función, con esta función se puede obtener el texto que hay entre 2 tags, si por ejemplo quieres obtener la descripcción de una web se haria de esta manera el tag de cierre sería ">.
El problema sigue siendo el mismo no entiende de acentos.. o eso es lo que pasa en mi server de pruebas ( a lo mejor está mal instalado o no :) ) |