title: PHP file_put_contents get file extension/type
body: <p>It's possible to get extension of a file with file_put_contents in PHP?</p>
  
  <p>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?</p>
  
  <p>Code sample:</p>
  
  <pre><code>&lt;?php 
  
    $url = 'http://www.domain.com/file/123';
    $fopen = fopen($url, 'r');
    file_put_contents("filename", $fopen);
    fclose($fopen);
  
  ?&gt;
  </code></pre>
  
  <p>How can I find out what type of a file, because if I put it with only the name becomes impractical?</p>