How do I check for valid (not dead) links programmatically using PHP?

后端 未结 9 1766
独厮守ぢ
独厮守ぢ 2020-12-08 08:24

Given a list of urls, I would like to check that each url:

  • Returns a 200 OK status code
  • Returns a response within X amount of time

The

9条回答
  •  自闭症患者
    2020-12-08 08:47

    One potential problem you will undoubtably run into is when the box this script is running on looses access to the Internet... you'll get 1000 false positives.

    It would probably be better for your script to keep some type of history and only report a failure after 5 days of failure.

    Also, the script should be self-checking in some way (like checking a known good web site [google?]) before continuing with the standard checks.

提交回复
热议问题