Не нашел нигде список всех расширений файлов, но зато наткнулся на сайт http://open-file.ru в котором приведен весь список расширений. Решил написать небольшой скрипт, который вытянет все расширения с описаниями и типами в XML файл.
<?php
set_time_limit(0);
$url = 'http://open-file.ru';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
preg_match('~<p>(.*)</p>~',$result,$match);
preg_match_all('~<a href="(/types/.*/)">.*</a>~Us',$match[1],$match);
$extension = array();
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<extensions>';
foreach( $match[1] as $link )
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ( $url . $link ));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
preg_match( '~<table>(.*)</table>~Us', $result, $table );
$reg = array(
'~<tr><td>.*<a href="/types/.*">(.*)</a>.*</td>',
'<td>.*<a href="/types/.*/">(.*)</a>.*</td><td>',
'.*<a href="/types/.*">(.*)</a>.*</td></tr>~'
);
preg_match_all(implode($reg),$table[1],$data);
foreach( $data[1] as $key => $ext )
{
$xml .= '
<extension>
<name><![CDATA[' . $ext . ']]></name>
<type><![CDATA[' . $data[2][$key] . ']]></type>
<description><![CDATA[' . $data[3][$key] . ']]></description>
</extension>
';
}
}
$xml .= '</extensions>';
file_put_contents('tmp/extensions.xml' , iconv( 'cp1251', 'utf8', $xml ) );
