Вот хороший пример использования catdoc :
function catdoc_string($str)
{
// requires catdoc
// write to temp file
$tmpfname = tempnam ('/tmp','doc');
$handle = fopen($tmpfname,'w');
fwrite($handle,$a);
fclose($handle);
// run catdoc
$ret = shell_exec('catdoc -ab '.escapeshellarg($tmpfname) .' 2>&1');
// remove temp file
unlink($tmpfname);
if (preg_match('/^sh: line 1: catdoc/i',$ret)) {
return false;
}
return trim($ret);
}
function catdoc_file($fname)
{
// requires catdoc
// run catdoc
$ret = shell_exec('catdoc -ab '.escapeshellarg($fname) .' 2>&1');
if (preg_match('/^sh: line 1: catdoc/i',$ret)) {
return false;
}
return trim($ret);
}
Источник