Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/02/2002, 18:33
vgaray
 
Fecha de Ingreso: octubre-2000
Ubicación: Juarez, Chih.
Mensajes: 161
Antigüedad: 24 años, 7 meses
Puntos: 0
Obtener el título de alguna páagina

Esta función sirve para obtener el texto que se encuentra entre <title> y </title> de cualquier página....

<%
Function titulo(de_esta_pagina)

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObje ct")

Dim objFile
Set objFile = objFSO.OpenTextFile(Server.MapPath(de_esta_pagina) )

Dim strContents
strContents = objFile.ReadAll

objFile.Close
Set objFile = Nothing
Set objFSO = Nothing

Dim objRegExp
Set objRegExp = New RegExp

Dim strHTML, strMatch
strMatch = "<title>(.*?)<\/title>"

objRegExp.Pattern = strMatch
objRegExp.IgnoreCase = True
objRegExp.Global = True

Dim objMatches
Set objMatches = objRegExp.Execute(strContents)

If objMatches.Count > 0 then
titulo = "El titulo de la página..." & de_esta_pagina & " es: " & Mid(objMatches(0).Value, 8, Len(objMatches(0).Value) - 16)
Else
titulo = "No se encontró el título de la página " & de_esta_pagina
End If
Set objRegExp = Nothing

End Function
%>

<%
Response.Write titulo("/algun_directorio/alguna_pagina.html")
%>

---------------------
Tan libre como gratuito!!!