PHP code example of tranch / scribe-client

1. Go to this page and download the library: Download tranch/scribe-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/ */

    

tranch / scribe-client example snippets




use Thrift\Protocol\TBinaryProtocol;
use Thrift\Transport\TFramedTransport;
use Thrift\Transport\TSocketPool;

$messages = array();

$msg1 = new LogEntry();
$msg1->category = 'foo';
$msg1->message = 'foo message';
$messages[] = $msg1;

$msg2 = new LogEntry();
$msg2->category = 'bar';
$msg2->message = 'bar message';
$messages[] = $msg2;

list($host, $post,) = array_slice($argv, 1);

$socket = new TSocketPool(array($host), array(intval($port)));
$transport = new TFramedTransport($socket);
$protocol = new TBinaryProtocol($transport);

$scribeClient = new scribeClient($protocol);

$transport->open();
$resultCode = $scribeClient->Log($messages);
$transport->close();

assert($resultCode == ResultCode::OK);