-1
Some time ago I had to check if an external image existed to be able to show it, at that moment I used it:
<?php
$file = 'http://answall.com';
$file_headers = @get_headers($file);
$position = strpos($file_headers[0], "404");
if ($position == -1) {
echo "o site está online.";
}
?>
I wonder if there is some other way to get the same result with php.
I don’t care if the url is in fact a url I just want to know if she really exists.
This point I think should have been clearer, the important thing for me is to check the URL independent of her Content-Type, what I really want is to know if it exists or not
– Erlon Charles
Yes, yes, I just took the opportunity to complement, given the example and even the future reference of finding this duplicate.
– Bruno Augusto