- Feasible Impossibilities - https://www.impossibilities.com/v4 -

Flash Remoting with PHP and the DesDev Resource Kit 2

I finally made some time today to dig into the wonderful work going on over at http://amfphp.sourceforge.net/ [1] Basically it is an open source project that revolves around some very useful PHP classes and scripts for which can encode/decode the binary AMF Flash Remoting stream format. I spent several hours playing and working with it today and I am very impressed withall the effort and work that has gone into it so far. I hope the activity level on the project can be sustained, as this is such a great project. It is SO useful if you don’t have JRUN or ColdFusion MX deployed on your servers yet, or you simply want to learn Remoting but only have access or the skills to work with PHP. It’s perfect for getting your feet wet with Flash Remoting [2].

Actually, earlier tonight I used AMF PHP [1], to enable the very cool MyPhoto application [3] that shipped on PHP [4] based web server. Here is an example of it runing on my server [5]. being driven solely by the AMF PHP Flash Remoting code. For the Flash .fla file, I only had to modify 3 lines of the ActionScript, specifically the gateway URL and the service connections, so that they reflected the location of my AMF PHP based gateway. That was it for the .FLA. The real meat of the work involved creating a PHP class that replicated the functionality of the ColdFusion Component (com.macromedia.apps.myphoto.cfc ) that Christian Cantrell [6] had written to drive the application. Fortunately it was well commented and fairly simple, so it was very straighforward to re-create it as a Class in PHP for use with the AMF PHP project. It works beautifully. Even the NetConnection Debugger and Gateway Browser in the Flash MX authoring environment work and report all the connections info, methods and services as you test and debug. Really very cool.

For those of you interested, I’ll package up the myphoto.php Class replacement I wrote and post it here later (after I get some sleep..look for it tomorrow.). Note: I will only be posting the myphoto.php class file I wrote, and the 3 modded lines of ActionScript and short instructions. I will NOT be posting the accompanying .FLA source. You’ll need to purchase a copy of the Macromedia DevNet Resource Kit Volume 2 [7] to obtain that portion of the project.

Happy Remoting and props to Christian Cantrell [6], Mike Chambers [8] and Steve “Leo” Leone [9] for their work on MyPhoto application.

UPDATE: As promised, here is the link to the source class file [10] to use with AMF PHP [1]. Make sure to read the comments in the source for instructions on modifying your .FLA source to work with it.