title: How to get image extension using file_get_contents php?
body: <p>I'm trying to copy to my server an image from another site and i plan to use</p>
  
  <pre><code>&lt;? 
  file_put_contents($toPath, file_get_contents($fromPath));
  ?&gt;
  </code></pre>
  
  <p>Ok, but to build the <code>$toPath</code> i need the extension of the file.
  I know how to do it if the <code>$fromPath</code> is a normal path with name of the file at the end, but if i use a path like facebook uses <code>http://graph.facebook.com/user_id/picture?type=large</code>
  how can i get the extension?</p>
  
  <p>Thank you all.</p>