Reciprocal Link Checker – Classic ASP

I was playing with one of my websites today, Only
Maltese
, and needed to put together a mechanism to check if the sites on the list
had a reciprocal link back to my site. The snippet I used might be useful to others,
so I’m adding it here for posterity:

<%

‘Declare
variables


Dim blnLinkBack,
sTargetURL, sTargetPage
Dim objXMLHTTP,
sHTML

blnLinkBack=False

sLinkBackURL=”www.only-network.com/maltese”

sTargetURL= <URLtoCheck>

If sTargetURL
<> “” Then

    On Error Resume Next

    
Grab target page


    Set objXMLHTTP = Server.CreateObject (“Microsoft.XMLHTTP”)
    objXMLHTTP.Open “GET”, sTargetURL, False

    objXMLHTTP.Send
    sHTML = objXMLHTTP.statusText

    If (Err.number=0 OR sHTML = “OK”) Then

        sTargetPage = objXMLHTTP.ResponseText

        If InStr(1,sTargetPage,
sLinkBackURL) > 0 Then

            blnlinkback = True

        Else

            blnlinkback = False

        End If

    Else

        blnlinkback = False

    End If

    Set objXMLHTTP=Nothing

Else

    blnLinkback=False

End If

%>

This is the first time I’m using the Source Code Formatter in dasBlog.
I like, although there’s no parsing option for VBScript.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.