Results 1 to 3 of 3

Thread: [2.0] Checking if a website / web page exists?

  1. #1

    Thread Starter
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    [2.0] Checking if a website / web page exists?

    Hi all!

    Does anyone have a way to check if a web page / website exists? Right now I'm simply catching the error that results when it does not but I'm wondering if there is a way to simply check that the page exists before trying to access it at all.

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [2.0] Checking if a website / web page exists?

    You could send a "HEAD" request to the server. Google should have loads of info about how to do this.

    You could do it with an HTTPWebRequest object.

    Then you check the stream that the server sends back if the first line contains "200" then you are in business, if you get a "404" instead you know what that means
    I don't live here any more.

  3. #3

    Thread Starter
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: [2.0] Checking if a website / web page exists?

    Quote Originally Posted by wossname
    You could send a "HEAD" request to the server. Google should have loads of info about how to do this.

    You could do it with an HTTPWebRequest object.

    Then you check the stream that the server sends back if the first line contains "200" then you are in business, if you get a "404" instead you know what that means
    Hmm, I will try the second one first and if that fails then I'll try the first - thanks

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width