The biggest problem with PHP and Flash (mediaserver) is the different "flow" of code. PHP is simple:
Run the request, do something, send a response. Done.
FlashMedia loads (compiles) your code when a client connects, and then only events are fired. Most operations are not returned, but require a callback.
Download the application .. wait for something .. Event triggered: do something, release another request along with the response handler object, etc.
I have an extensive chat service with FlashMedia server and PHP both front and server.
The interface is simple: simple PHP / HTML pages that will eventually create a <OBJECT> -tag loading of some Flash applet. This flash applet must connect to the flash server using the information / credentials passed to it with the FlashVars parameter or the downloaded (generated) XML data from a separate URL.
From this point, the Flash applet (client) does this with the Flashmedia server. In this example, you want to verify the credentials from Mediaserver. You must use AMFPHP for this.
AMFPHP is a replacement for Macromedia's "Flash Remoting", where Flash [applets / servlets] can perform asynchronous communication over HTTP.
For the AMFPHP environment, you are writing an interface class that completes your validation code. There is a test page that confirmed the answer of your wrapper.
(The AMFPHP Framework can also generate AS2 sample code, so you have an idea how the Flashmedia server should send the request and process the responses.)
- Warning: AMFPHP uses POST to send and retrieve data. In the past, there were problems when 2k data was truncated. I now only use it for relative short messages.
- AMFPHP is very reliable. You can use it for external logging, for example.
Willem
source share