Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP Script to check if a web site is up

Options
  • 19-01-2005 12:21pm
    #1
    Registered Users Posts: 12,309 ✭✭✭✭


    Would anyone know a handy asp script for checking if a site is up or not?
    For example, I'd like to be able to check if a particular URL is up and active before grabbing data from it or providing a link to it.

    Any suggestions?

    (ASP only please)


Comments

  • Registered Users Posts: 7,739 ✭✭✭mneylon


    have a look at:
    http://www.aspin.com/home/components/internet/pingfunc

    You basically want to do a ping on a hostname and depending on the response take action (or not)

    If it was a specific URL you could try running a HEAD command on it to get the response code I suppose ...


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    If the Microsoft XML parser is installed (or can be) on your webserver, then you can create a HTTP REQUEST for a page on the remote server. If you do your error handling, you can then return a message if the request fails.

    Eoin


  • Registered Users Posts: 12,309 ✭✭✭✭Bard


    It's the XML Parser that I'm using to grab the data from the other site so I guess I'll just read up on error handling. Thanks.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    found this on ASP FAQ :
    <% 
        ' deliberate typo: 
        url = "http://www.espn.co/main.html"  
        set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")  
        on error resume next 
        xmlhttp.open "GET", url, false 
        xmlhttp.send ""  
        if err.number <> 0 then 
            response.write "Url not found" 
        else 
            Response.write xmlhttp.responseText  
        end if 
        set xmlhttp = nothing 
    %>
    

    This should do what you are looking for?

    Eoin


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin




  • Advertisement
Advertisement