php to check for 404

I was wondering if there was any way of using php to see if a link will result in a 404 error. So more or less is there any way to check if a link works.


I couldn’t find anything that would be a definitive solution to this problem.

You maybe able to use $_SERVER[’’] variables to get something that will work.

What are you trying to accomplish, maybe there is a different way about going about it.

If tell me what you are doing or trying to do, I might be able to give some alternatives.

I have a website that has links to another website. I was wondering if there is any way using php to see if the link works(it would be a .divx download link).

I was doing some searching and I did find some scripts that will give you a report on all broken links.

I went to and search for Broken link checker. Brought up several free scripts. You could maybe use one of them and modify if need be.

Hope that helps.

hmm i looked at all the scripts but they are too complicated. I found one and it works if i put a link into a page(it searches a whole page finding links then checking each link), but I want to be able to just put in a link and then it says if it is works or not. I cannot seem to find the part that does that because it is too complicated.

Sponsor our Newsletter | Privacy Policy | Terms of Service