- I need to make an internal website which allows users to upload .doc, .pdf, .xls files and see the text in a textarea box.
- I have created the site in PHP to the point where a user can upload the files.
- I have installed Tika on my server and at the command line can type
java -jar tika-app-1.10-SNAPSHOT.jar -m manu.pdf > output.txt
which successfully creates the text I need in the output file.
What is the best way to call Tika from PHP in order to get the plain text of an uploaded file into PHP?
Searching around I find:
- PHP code that makes calls to a "Tika server" e.g. with cURL
- PHP Wrapper classes for Tika which seem to use Tika on the same server that PHP is installed on, but I have not gotten any of them to work.
- Alternatively, I could simply call Tika via the
exec
command.
But I'm not sure what is the easiest way to proceed.