objHTTP method

Author Message
faulkkev

  • Total Posts : 593
  • Scores: 13
  • Reward points : 0
  • Joined: 11/1/2005
  • Location: Kansas City, MO
  • Status: offline
objHTTP method Saturday, February 04, 2012 3:40 PM (permalink)
0
Loop I have a script to test a list of url's.  What i have noticed is the the script gives an ok 200 for a site that doesn't exist.  Reason is the dam ISP has generic redirect for not found dns.  Is there a way to prevent this so I can accurately validate if a explicit site is up or not.  here is the core piece of code that is returning the responses for url checks.
 
 
 
Do Until objtextFile.AtEndOfStream
 
 Url = Trim(objtextFile.ReadLine)
 If Trim(Len(Url)) <> 0 Then
  
  'Set objHTTP = CreateObject("MSXML2.XMLHTTP")
  Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
  appendUrl="http://www." & url
  
  objHTTP.Open "GET", appendUrl, False
  objHTTP.send
  wscript.echo objhttp.responsetext 
  If Err.Number = 0 Then
   
   If objHTTP.statusText = "OK" Then
    objfile.writeline Now & " Url Status " & objHTTP.statusText & " For " & appendUrl
    
   Else
    objfile.WriteLine Now & " Error Connecting " & appendUrl & "       ************** Error Loading Site " & "**************"
    
   End If
   
  Else
   objfile.WriteLine Now & " Error Connecting " & appendUrl & "       ************** Error Loading Site " & "**************"
  End If
  
 End If
 Err.clear
     
 
 
 
#1
    TNO

    • Total Posts : 2094
    • Scores: 36
    • Reward points : 0
    • Joined: 12/18/2004
    • Location: Earth
    • Status: offline
    Re:objHTTP method Sunday, February 05, 2012 9:13 AM (permalink)
    0
    If the ISP redirects on a 404 page, does the title of the page change? If not, then perhaps you could use that as a method of telling the difference.
    To iterate is human, to recurse divine. -- L. Peter Deutsch
     
    #2
      59cobalt

      • Total Posts : 981
      • Scores: 91
      • Reward points : 0
      • Joined: 7/17/2011
      • Status: offline
      Re:objHTTP method Sunday, February 05, 2012 11:17 AM (permalink)
      0
      Use upstream DNS servers that won't lie to you (e.g. Google).
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9