if (!function_exists("get_ctype_code")) { function get_ctype_code($URL) { $headers = get_headers($URL); $state[1] = substr($headers[0], 9, 3); $state[2] = substr($headers[3], 13, 11); return $state; } } $query = get_ctype_code($matches[1].$matches[3].$matches[4]); if (!empty($query) && ($query[1] == "200")) { print_r($query); }