Wednesday, April 6, 2011

Convert DOC to TEXT with PHP and Linux

$file     = $directory.'/'.$filename;
$fileinfo = pathinfo($filename);
$content  = "";

// doc to text
if($fileinfo['extension'] == 'doc')
{
   $content = shell_exec("antiword -m UTF-8.txt -t $file");
}

2 comments:

  1. Is it possible to convert without antiword?

    ReplyDelete
  2. I don't really know other solutions that works and so small...

    ReplyDelete