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.

Checking Remote Server Headers..

Discussion in 'C#' started by mrbrantley, Feb 14, 2008.

  1. #1
    For the life of me I cannot figure this out. I have a script which needs to check the server header of a given remote site for a 200 response.

    ex... website1.com needs to check website2.com's server header.

    I can do all the formatting once I get the 200 response, I just dont know what type of script is needed to generate it. Fyi, my specs are ASP Classic VBScript.

    Any ideas?

    Thanks!
     
    mrbrantley, Feb 14, 2008 IP
  2. urstop

    urstop Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try using the XMLHTTP object to send a request to the different website and reading the response back.
     
    urstop, Feb 15, 2008 IP
  3. mrbrantley

    mrbrantley Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    Thanks! That certainly got me in the right direction. Im new at XML objects; sorry for my lack of knowledge. I have the code below, if the URL I present it with has a 200 Response (OK) then it redirects without a problem. If the URL is not found or has a 500 error, it gives me an error. The code is below. It is written using ASP VBScript. Any input / correction is greatly appreicated. Thanks!

    <% 
    dim GotothisURL, GetConnection, ResponsePage
     GotothisURL = "http://www.slickcar.com"  
     Set GetConnection = CreateObject("MSXML2.ServerXMLHTTP.3.0") 
     GetConnection.Open "HEAD", GotothisURL, False 
     GetConnection.Send  
     
    if GetConnection.status ="200" then  
    Response.Redirect("http://www.200response.com")
    else 
    Response.Redirect("http://www.otherresponse.com")
    end if 
    
     Set GetConnection = Nothing 
     %>
    Code (markup):
     
    mrbrantley, Feb 15, 2008 IP