📅  最后修改于: 2022-03-11 14:54:28.500000             🧑  作者: Mango
New file_get_contents that checks valid urls
function get_contents_url($url, $u = false, $c = null, $o = null) {
if (filter_var($url, FILTER_VALIDATE_URL)) {
$headers = get_headers($url);
$status = substr($headers[0], 9, 3);
if ($status == '200') {
return file_get_contents($url, $u, $c, $o);
}
}
return false;
}