I am trying to display all links in a given string and its stoping right at the end and I can not figure out why. This is the code I have, is there something better? or a better way of doing it?
Here is an example of the code at work...
http://207.21.203.31/test.asp
<%
Set HttpObj = Server.CreateObject("AspHTTP.Conn")
HTTPObj.Url = "http://207.21.203.31/contact/email.asp"
strResult = HTTPObj.GetURL
iCurrentLocation = 1
Do While InStr(iCurrentLocation, strResult, "http://", 1) <> 0
iLinkStart = InStr(iCurrentLocation, strResult, "http://", 1)
iLinkEnd = InStr(iLinkStart, strResult, "'", 1)
iLinkEnd2 = InStr(iLinkStart, strResult, """", 1)
iLinkEnd3 = InStr(iLinkStart, strResult, " ", 1)
if iLinkEnd2 < iLinkEnd then
iLinkEnd = iLinkEnd2
end if
if iLinkEnd3 < iLinkEnd then
iLinkEnd = iLinkEnd3
end if
If iLinkEnd = 0 Then iLinkEnd = Len(strResult) + 1
Select Case Mid(strResult, iLinkEnd - 1, 1)
Case ".", "!", "?"
iLinkEnd = iLinkEnd - 1
End Select
strOutput = strOutput & Mid(strResult, iCurrentLocation, iLinkStart - iCurrentLocation)
strLinkText = Mid(strResult, iLinkStart, iLinkEnd - iLinkStart)
Response.Write strLinkText & vbCrLf & "<br>"
iCurrentLocation = iLinkEnd
Response.Write vbCrLf & "<p>"
Loop
%>
Brad