Hi,
nice thought, actually it took me 5mins to solve the problem, because php5 offers finfo object. I did it like that:
1. First I’ve changed compareExt function to this:
function compareExt($url) {
//get file extension from url
$extension = self::getMime($url);
//check if mime headers = application/zip
if($extension == 'application/zip'):
return true;
else:
return false;
endif;
}
2. Than I’ve added getMime function, which uses finfo_buffer to get mime headers.
function getMime($url) {
//get file from url
$file = file_get_contents($url);
//create finfo object with FILEINFO_MIME_TYPE as argument
$finfoObject = new finfo(FILEINFO_MIME_TYPE);
//return mime header
return $finfoObject->buffer($file);
}
I’ll update the code as soon as possible. Thanks for an IDEA! ??
Best regards,
Zagal