Location: PHPKode > projects > PHPOlait Extended > phpolait/examples/rename.php
<?php

  require_once ("../phpolait/phpolait.php");

  /**
   * Simple test class for the JSON RPC server
   */
  class RestrictedServer {
		
    function myecho($msg) {
      return $msg;
    }

    function hidden() {
      return "Inaccessible method";
    }

    function version() {
      return "PHP-O-Lait Version 0.5";
    }
  }

  $server = new JSONRpcServer( new RestrictedServer(), 
		array ("version"=>true, "Echo"=>"myecho")
	);
?>
<html>
<head>
<?php $server->javascript('proxy'); ?>
</head>
<html>
<script type="text/javascript">
		function pHidden(){
			var rslt = '';
			rslt = proxy.hidden;
			alert(rslt);
		}
				
</script>
<body>
<a href="javascript:alert(proxy.Echo('Echo from server'));">
Echo('Echo from server')</a><br />
<a href="javascript:alert(proxy.version());">
version()</a><br />
<a href="javascript:pHidden();">
hidden()</a> 
(Won't produce an error since the JavaScript method does not exist.)<br />
</body>
</html>

Return current item: PHPOlait Extended