1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

hmlhttp request to check if URL is valid - not working

Discussion in 'C#' started by grobar, Aug 25, 2006.

  1. #1
    I use the following code to chck for a working url. It does work for some, but sites that seem to be written in PHP, and google, seem to return a "fail" - I can't figure out how to get p-ast this.

    
        Dim objHTTP
        Dim sHTML
        Set objHTTP = Server.CreateObject ("Microsoft.XMLHTTP")
        objHTTP.open "GET", strURL, False
        objHTTP.send
        sHTML=objHTTP.statusText
        if err or sHTML<>"OK" Then
        sTxt="fail"
        else
        sTxt="ok"
        End if
        Set objHTTP=nothing
        else
        sTxt="fail"
        End if
    
    Code (markup):
    any suggestions would be appreciated.
     
    grobar, Aug 25, 2006 IP
  2. Mano70

    Mano70 Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If I'm not wrong Google may do a redirect (ex. it sends me to my local Google page). Do you get the error with other redirect pages? But it can also be some settings on your server (but I can't tell you which).

    Anyway, I think you must look into using CreateObject("WinHTTP.WinHTTPRequest.5.1") instead of Server.CreateObject("Microsoft.XMLHTTP")
     
    Mano70, Aug 25, 2006 IP
  3. Link.ezer.com

    Link.ezer.com Peon

    Messages:
    647
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #3
    1. code error : take off the end of 3 lines
    else
    sTxt="fail"
    End if

    no need

    2. it runs very well .... try again .... and let us know the result. :)
     
    Link.ezer.com, Aug 26, 2006 IP