It's possible to get extension of a file with file_put_contents in PHP?
I want to download files from a server using php with cycle, but each file has a different type and I want to know if there is a way to understand the extension of each file?
Code sample:
<?php
$url = 'http://www.domain.com/file/123';
$fopen = fopen($url, 'r');
file_put_contents("filename", $fopen);
fclose($fopen);
?>
How can I find out what type of a file, because if I put it with only the name becomes impractical?