Detecting Dead Links

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Detecting Dead Links

    Hi,

    I have a number of Links (coming from a database, but that does not matter)
    and I want to check using a PHP-script if they "work" or if they are "dead"
    (error 404 or something like that).

    Now, what happens if I use fopen() to test a dead link? Do I get an error
    (that would be good) or do I get the Error404-HTML-Page from the webserver
    and can not determine if it is a "valid" page or just the Error-Page?

    Does anyone have an idea how to test for dead links using PHP?

    Thanks,
    Paul
    [url]www.eigelb.at[/url]


    Paul Schmidinger Guest

  2. Similar Questions and Discussions

    1. Netscape and dead links
      State the Pub version being used, the version of NS tested, the URL of the site. -- David Bartosik - MS MVP www.publishermvps.com "islander"...
    2. check for dead links
      I have a database with hundreds of urls Is there a quick way to validate these links and to get a report with the dead links... thx! dany
    3. DEAD MAC! - HELP!!!
      Hey Group... Any suggestions would be greatly appreciated!!! My home computer just died this past weekend....It's a Mac G3 Desktop 266mHz...
    4. detecting links
      Is there any simple way to determine if a reference returned via readdir is a soft- or hardlink rather than a directory or filename. None of my...
    5. Dead DNS
      My Solaris 9 box will not resolve any addresses. It is DHCP and the resolv.conf has not changed. I've tried releasing the IP and rebooted.. no...
  3. #2

    Default Re: Detecting Dead Links

    *** Paul Schmidinger wrote/escribió (Fri, 25 Jun 2004 12:58:43 +0200):
    > Now, what happens if I use fopen() to test a dead link? Do I get an error
    > (that would be good) or do I get the Error404-HTML-Page from the webserver
    > and can not determine if it is a "valid" page or just the Error-Page?
    You have to check the headers returned by the server, not the page itself.
    They look like this:

    HTTP/1.1 200 OK
    Date: Fri, 25 Jun 2004 11:00:24 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    MicrosoftOfficeWebServer: 5.0_Pub
    Content-Length: 750
    Content-Type: text/html
    Cache-Control: private
    Age: 2

    Please note the numeric code in the first line (in this example, 200),
    that's the useful info. Please note it can be a redirect code--that's what
    you send to client when you use header('Location: http//.....') in your
    scripts.

    As about the best way to check the HTTP status code, I don't have any
    experience. However, I believe the chapter "CURL, Client URL Library
    Functions" in PHP docs can be what you need.


    --
    --
    -- Álvaro G. Vicario - Burgos, Spain
    --
    Alvaro G Vicario Guest

  4. #3

    Default Re: Detecting Dead Links

    Thanks a lot, that should do it!

    Paul Schmidinger
    [url]www.eigelb.at[/url]

    "Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> schrieb im
    Newsbeitrag news:shhqbr09g9zx.143by67nrce7p$.dlg@40tude.net...
    > *** Paul Schmidinger wrote/escribió (Fri, 25 Jun 2004 12:58:43 +0200):
    > > Now, what happens if I use fopen() to test a dead link? Do I get an
    error
    > > (that would be good) or do I get the Error404-HTML-Page from the
    webserver
    > > and can not determine if it is a "valid" page or just the Error-Page?
    >
    > You have to check the headers returned by the server, not the page itself.
    > They look like this:
    >
    > HTTP/1.1 200 OK
    > Date: Fri, 25 Jun 2004 11:00:24 GMT
    > Server: Microsoft-IIS/6.0
    > X-Powered-By: ASP.NET
    > MicrosoftOfficeWebServer: 5.0_Pub
    > Content-Length: 750
    > Content-Type: text/html
    > Cache-Control: private
    > Age: 2
    >
    > Please note the numeric code in the first line (in this example, 200),
    > that's the useful info. Please note it can be a redirect code--that's what
    > you send to client when you use header('Location: http//.....') in your
    > scripts.
    >
    > As about the best way to check the HTTP status code, I don't have any
    > experience. However, I believe the chapter "CURL, Client URL Library
    > Functions" in PHP docs can be what you need.
    >
    >
    > --
    > --
    > -- Álvaro G. Vicario - Burgos, Spain
    > --

    Paul Schmidinger Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139