PHP function to return a remote url mime type:
function get_remote_mime_type($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_exec($ch); return curl_getinfo($ch, CURLINFO_CONTENT_TYPE); }