Question : php check if external file exists
Answered by : xerothermic-xenomorph-3xrwty1j797o
$file = 'http://www.domain.com/somefile.jpg';
$file_headers = get_headers($file);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') { $exists = false;
}
else { $exists = true;
}
Source : | Last Update : Wed, 10 Aug 22