AMFPHP :: Tiny-Mini-Little introduction

57 %
43 %
Information about AMFPHP :: Tiny-Mini-Little introduction

Published on October 20, 2008

Author: calin.iepure



What is AMF?
What is AMFPHP?
How it works?

AMFPHP Tiny-Mini-Little introduction Călin Iepure, X3 Studios

What is AMF? • Action Message Format (AMF) • Is a binary format based loosely on the Simple Object Access Protocol (SOAP). It is used primarily to exchange data between an Adobe Flash application and a database, using a RPC • Was introduced with Flash Player 6, and was unchanged until the release of Flash Player 9 and ActionScript 3.0, when new data types and language features prompted an update

And what is it? • AMF is what Flex and Flash Remoting use to talk to the back-end server (Java, ColdFusion, PHP, etc.). • It provides serialization of Action Script Objects native types and objects to be sent to the server where they are unserialized into the server languages data type. • The serialization process is 100% binary in its transmission over port 80/443 • As of AMF3 the data is also compressed for faster transmission.

Then, what suppose to be AMFPHP? • The AMFPHP project aims to provide an open source alternative for Flash Remoting • The end result should be as capable of providing remote web services to a client as are the Macromedia commercial Flash Remoting packages. • AMFPHP are trying to keep the usage of the gateway as close as possible to the ColdFusion version to give Flash developers the freedom to change server technologies with minimum impact on ActionScript code.

Could you speak more clearly? • AMFPHP is an RPC toolkit for PHP. • It allows seamless communication between PHP and:  Flash and Flex with Remoting  JavaScript and Ajax with JSON  XML clients with XML-RPC • Current version is 2.0

How it works behind the scenes? • The server and the client, say PHP and Flash, agree on a common way of describing method calls and complex data. • The client serializes a request and sends it to a gateway. • AMFPHP then automatically:  Deserializes the request  Finds the corresponding remote class  Instantiates the class  Performs security checks  Calls the remote method using the specified arguments  Serializes the returned data

How it works behind the scenes? • AMFPHP can properly serialize and deserialize complex types. • In addition to objects and arrays, it supports resources from database connections, which means you can simply return mysql_query from your remote method and AMFPHP will know what to do with it • If the platform supports it (currently, Flash Remoting only), it can handle circular references and typed objects. • It also supports simple remote debugging. Finally, AMFPHP comes with a service browser which allows you to test your services before creating a frontend.

Remoting at the speed of GZIP… • Actual version comes with nice speed boost in the form of decreased transfer times over the wire, thanks to gzip encoding. • Basically, if a browser sends an Accept:gzip header to the server (ie, all modern browsers since IE5), AMFPHP will detect it and send the content gzipped. • For large amounts of data, this can result in much decreased network traffic; typical compression ratios can vary from 2:1 to 10:1, depending on data set • The nice part is that, once again, you don't need to configure anything to get this to work!

NetConnection in Flash Player • Flash Player 9 has native support for NetConnection in the package which provides everything necessary for AMF communication. • This means that there is no longer a need to download and install Flash remoting classes or components • It also means that every Flash Player now has the encoding and decoding nativly supported and does not require additional code to be downloaded

What about Flex? • Flex 2 and Flex 3 has a package built on top of called RemoteObject • RemoteObject gives you several helper functions that make development of large AMF applications much easier than using the native NetCOnnection • RemoteObject has a concurrency property that makes larger applications much easier to build. • It also has a ShowBusy cursor that you can use if the UI is useless unless it has updated data from the server

Demos ??? • Installation in 4 minutes • Making sure it works • Background info • Creating a remoting compatible service • Testing in the service browser • Security concerns • Understanding SQL injection • Preventing SQL injection • Etc…

Demos ?

Links • • • oup_id=72483#files •

Add a comment

Related presentations

Related pages

FLASH and RPC using AMFphp - Documents

FLASH and RPC using AMFphp. What are we talking about here?. A simple integration of actionscript and php. Also integrates Flex, Javascript, Ajax, XML. The ...
Read more