Prev | Current Page 804 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


In the example, the AMFPHP server is used on the server side. AMFPHP is an open source
implementation for PHP realized originally by Wolfgang Hamann and released under the GNU License
(GNU is a recursive acronym for GNU is Not Unix). The code has been tested with both versions 1.2.6
and 1.9 beta. To try the following code, be sure you have installed PHP correctly (PHP 5 is required for
version 1.9) and mapped the AMFPHP folder properly to a path such as the one used in the code. The
client code is very easy and doesn ??™ t differ from the ones seen earlier.
// content of the file Client.hx
import haxe.remoting.AsyncConnection;
class Client
{
public static function main()
{
var cnx = AsyncConnection.amfConnect(???http://localhost/amf/gateway.php???);
cnx.onError = function(e)
{
trace(???Error: ??? + Std.string(e));
};
cnx.Calc.sum.call([5,4], function(data)
{
trace(Std.string(data));
});
}
}
For the server side, create a file Calc.php in the services folder of the AMFPHP installation directory.


Pages:
792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816