Sample code for 30+ languages & platforms
PHP Extension Requires Chilkat v11.0.0+

Workaround for the deprecated Crypt2.Encode method

Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.)

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$crypt = new CkCrypt2();

$path = 'c:/someDir/example.dat';

//  Such as base64, hex, hex_lower, etc.
$encoding = 'base64';

//  ------------------------------------------------------------------------
//  The Encode method is deprecated:

$inData = new CkByteData();
$inData->loadFile($path);

$encodedBytes = $crypt->encode($inData,$encoding);

//  ------------------------------------------------------------------------
//  Workaround.
//  (Chilkat is moving away from using CkByteData)

$bd = new CkBinData();
$bd->LoadFile($path);

$encodedBytes = $bd->getEncoded($encoding);

?>