(PHP Extension) Workaround for the deprecated Crypt2.Encode method
Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.) Note: This example requires Chilkat v11.0.0 or greater.
<?php
include("chilkat.php");
// Use "chilkat_9_5_0.php" for versions of Chilkat < 10.0.0
$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);
?>
|