Php Check If External File Exists

[Solved] Php Check If External File Exists | Php - Code Explorer | yomemimo.com
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

Answers related to php check if external file exists

Code Explorer Popular Question For Php