I have around 10000 links in my database. Now I want to check it whether some of them are dead or not. How can I test whether an URL is live or dead?

Bozidar Dangubic

Open up an url connection and check the header of the response. Header will contain codes that mean different things such as 500 - Internal Server Error, 404 - Not Found. Code 200 means ok, so you can check each link and check the code on the header. If it is not 200, then it is not alive. Bear in mind that the link can be temporarily down so if you plan to delete urls from your database, you probably need to come up with some scheme that you feel confortable that the link is actually dead and not just temporarily unavailable.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact