This should work. It requires the ASPhttp component and line 97 needs
to be changed to whatever URL you are pointing at.
<%
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|\n)+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function
Function stripCSSTags(strCSS)
x = 1
SOn = 1
strOutput = ""
Do While x < Len(strCSS)
If Mid(strCSS,x,6) = "<style" Then
SOn = 0
x = x + 1
End If
If SOn = 1 Then
strOutput = strOutput & Mid(strCSS,x,1)
Else
' Response.Write(Mid(strCSS,x,6) & Chr(13))
End If
If Mid(strCSS,x,8) = "</style>" Then
SOn = 1
x = x + 1
End If
x = x + 1
Loop
stripCSSTags = strOutput
End Function
Function stripScriptTags(strScript)
x = 1
SOn = 1
strOutput = ""
Do While x < Len(strScript)
If Mid(strScript,x,7) = "<script" Then
SOn = 0
x = x + 1
End If
If SOn = 1 Then
strOutput = strOutput & Mid(strScript,x,1)
Else
' Response.Write(Mid(strScript,x,6) & Chr(13))
End If
If Mid(strScript,x,9) = "</script>" Then
SOn = 1
x = x + 1
End If
x = x + 1
Loop
stripScriptTags = strOutput
End Function
Function stripOutLink(linos)
If IsNull(linos) Or Len(linos) < 3 Then
stripOutLink = FALSE
Else
Dim funcObjRegExp
Set funcObjRegExp = New Regexp
funcObjRegExp.IgnoreCase = True
funcObjRegExp.Global = True
funcObjRegExp.Pattern = "<a href\="
aref = "<a href="""
If IsEmpty(linos) OR IsNull(linos) Then
stripOutLink = FALSE
End If
If (funcObjRegExp.Test(linos)) Then
lpos = InStr(LCase(linos),aref)
rpos = InStr(LCase(linos),""">")
stripOutLink = Mid(linos,lpos+9,(rpos-(lpos+9)))
Else
stripOutLink = FALSE
End If
End If
End Function
Set HttpObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = "http://mike.dewolfe.bc.ca/index.asp"
myURLfile = HTTPObj.GetURL
For x = 0 to 12
myURLfile = Replace(myURLfile,Chr(x),"")
Next
Dim URLines
Dim TenLinks(10)
Ten = 0
Lines = 0
If InStr(myURLfile,Chr(13)) > 1 Then
URLines = split(myURLfile,Chr(13))
Else
URLines = myURLfile
End If
Do While Ten < 10 And UBound(URLines) > Lines
If stripOutLink(URLines(Lines)) <> FALSE Then
If Left(stripOutLink(URLines(Lines)),4) = "http" Then
TenLinks(Ten) = stripOutLink(URLines(Lines))
Else
TenLinks(Ten) = "http://www.domain.com/" & stripOutLink(URLines(Lines))
End If
Ten = Ten + 1
End If
Lines = Lines + 1
Loop
OnlyText = stripCSSTags(myURLfile)
OnlyText = stripScriptTags(OnlyText)
OnlyText = stripHTML(OnlyText)
OnlyText = Replace(OnlyText," ","")
OnlyText = Replace(OnlyText," ","")
OnlyText = Replace(OnlyText," " & Chr(13),Chr(13))
OnlyText = Replace(OnlyText,Chr(13) & Chr(13),"")
%>
<% For x = 0 to 9 %>
<% =TenLinks(x) %><br>
<% Next %>
<br>
<% =OnlyText %> |