. * * Consult LICENSE file for details ************************************************/ if (count($argv) < 2) { die("\tUsage: printwbmxl.php WBXML-INPUT-HERE\n\n"); } $wbxml64 = $argv[1]; // include the stuff we need include_once('../../src/lib/utils/stringstreamwrapper.php'); include_once('../../src/lib/wbxml/wbxmldefs.php'); include_once('../../src/lib/wbxml/wbxmldecoder.php'); include_once('../../src/lib/wbxml/wbxmlencoder.php'); // minimal definitions & log to stdout overwrite define('WBXML_DEBUG', true); define("LOGLEVEL_WBXML", "wbxml"); define("LOGLEVEL_DEBUG", "debug"); class ZLog { static public function Write($level, $msg, $truncate = false) { // we only care about the wbxml if ($level == "wbxml") { if (substr($msg,0,1) == "I") { echo substr($msg,1) . "\n"; } else { echo $msg . "\n"; } } } } // setup $wxbml = StringStreamWrapper::Open($wbxml64); $base64filter = stream_filter_append($wxbml, 'convert.base64-decode'); $decoder = new WBXMLDecoder($wxbml); if (! $decoder->IsWBXML()) { die("input is not WBXML as base64\n\n"); } echo "\n"; // read everything and log it $decoder->readRemainingData(); echo "\n";