PHP I want to check if link is webpage or file

Please help me to solve this very simple question. I have a lot of URLs(links) in my database. So I want to check if each URLs are file or webpage. For example "" is webpage


"" is file

I can't classify URLs to file and page. At first, I tried to classify links by checking "." from URL's basename. But it failed. I used many functions like is_link(), file_exists() and is_file() , etc but it can't work. And we can use curl but it takes some time to analyze link. An enormous amount of URLs have to be classified on my DB so speed is important.

I just need to classify page or file. Not to get infos just classify. I can't find answer at "What's the easiest and quickest way to get the MIME/Media/Content type of a given URL?" Thanks.