Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

ASP Script to check if a web site is up

  • 19-01-2005 12:21PM
    #1
    Registered Users, Registered Users 2 Posts: 12,311 ✭✭✭✭


    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, Registered Users 2 Posts: 7,742 ✭✭✭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, Registered Users 2 Posts: 21,278 ✭✭✭✭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, Registered Users 2 Posts: 12,311 ✭✭✭✭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, Registered Users 2 Posts: 21,278 ✭✭✭✭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, Registered Users 2 Posts: 21,278 ✭✭✭✭Eoin




  • Advertisement
Advertisement