PHP code example of bangpound / tika-rest-client

1. Go to this page and download the library: Download bangpound/tika-rest-client 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/ */

    

bangpound / tika-rest-client example snippets



$client = new Bangpound\Tika\Client('http://localhost:9998');
$response = $client->tika(array(
    'file' => 'TestPDF.pdf',
));

// Metadata varies by file and file type, so refer to the Apache Tika docs for details.
$all_metadata = $response->metadata;

// If you know the metadata element you want to retrieve, specify it as the argument
// to the response's metadata method.
$author = $response->metadata('author');

// Extracted content can be retrieved as a SimpleXMLElement or a string of XML.
$content_xml = $response->getBody();
$page_2 = $content_xml->children()->div[1];

$content_text = $response->getBody(true);