/** * Tests obtaining of the gateway instance. */ public function testObtainGateway() { $this->assertContains('PHPGateway', java_inspect($this->_neoGateway), 'PHPGateway object not returned.'); }
#!/usr/bin/php <?php include_once "java/Java.inc"; $here = realpath(dirname($_SERVER["SCRIPT_FILENAME"])); if (!$here) { $here = getcwd(); } java_require("{$here}/binaryData.jar"); $binaryData = new Java("BinaryData"); echo java_inspect($binaryData);
<?php include_once "java/Java.inc"; $passwd = "hello"; try { java_require("mail.jar"); // mail.jar is not part of the standard jdk $password = new java("java.lang.String", "{$passwd}"); $algorithm = java("java.security.MessageDigest")->getInstance("md5"); $algorithm->reset(); $algorithm->update($password->getBytes()); $encrypted = $algorithm->digest(); $out = new java("java.io.ByteArrayOutputStream"); java_inspect(java("javax.mail.internet.MimeUtility")); $encoder = java("javax.mail.internet.MimeUtility")->encode($out, "base64"); $encoder->write($encrypted); $encoder->flush(); echo new java("java.lang.String", $out->toByteArray()); echo "\n"; exit(0); } catch (Exception $e) { echo "Echo invocation failed: {$e}\n"; //print_r ($e->getTrace()); exit(1); } ?>