Method to search if URL exists in a particular link

by barkkathulla 2013-03-01 09:23:19

How to search if URL exists in a particular link

This method is the easiest way to check whether a proper url is having in a particular link.
many of them click the wrong link and choose in complex way.Using the following trick you can do it in a useful way.




$file = 'http://your site/path(any)';
$file_headers = @get_headers($file);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
$exists = false;
}
else {
$exists = true;
}

Tagged in:

459
like
0
dislike
0
mail
flag

You must LOGIN to add comments