PHP code example of hocvt / php-apache-tika

1. Go to this page and download the library: Download hocvt/php-apache-tika library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hocvt / php-apache-tika example snippets


composer 

$client = \Vaites\ApacheTika\Client::make('localhost', 9998);           // server mode (default)
$client = \Vaites\ApacheTika\Client::make('/path/to/tika-app.jar');     // app mode 

$client = \Vaites\ApacheTika\Client::prepare('localhost', 9998);
$client = \Vaites\ApacheTika\Client::prepare('/path/to/tika-app.jar'); 

$client = \Vaites\ApacheTika\Client::make('http://localhost:9998');
$client = \Vaites\ApacheTika\Client::prepare('http://localhost:9998');

$language = $client->getLanguage('/path/to/your/document');
$metadata = $client->getMetadata('/path/to/your/document');

$html = $client->getHTML('/path/to/your/document');
$text = $client->getText('/path/to/your/document');

$client = \Vaites\ApacheTika\Client::make($host, $port);
$metadata = $client->getMetadata('/path/to/your/image');

$text = $client->getText('/path/to/your/image');

$client->getMetadata($file);
$client->getRecursiveMetadata($file, 'text');
$client->getLanguage($file);
$client->getMIME($file);
$client->getHTML($file);
$client->getText($file);
$client->getMainText($file);

$client->getSupportedMIMETypes();
$client->getAvailableDetectors();
$client->getAvailableParsers();
$client->getVersion();

$client->getEncoding();
$client->setEncoding('UTF-8');

$client->getSupportedVersions();
$client->isVersionSupported($version);

$client->setCallback($callback);
$client->getCallback();

$client->setChunkSize($size);
$client->getChunkSize();

$client->setDownloadRemote(true);
$client->getDownloadRemote();

$client->setPath($path);
$client->getPath();

$client->setJava($java);
$client->getJava();

$client->setHost($host);
$client->getHost();

$client->setPort($port);
$client->getPort();

$client->setUrl($url);
$client->getUrl();

$client->setRetries($retries);
$client->getRetries();

$client->setOptions($options);
$client->getOptions();
$client->setOption($option, $value);
$client->getOption($option);

$client->setTimeout($seconds);
$client->getTimeout();