Question

I am receiving encoded data from flash in AMF format, but I want to decode it in php .

I do not know how can I use the library https://github.com/silexlabs/amfphp-2.0/blob/master/Amfphp/Core/Amf/Serializer.php

I cant find a sample code that instructs how to do a simple decode of AMF encoded message

Was it helpful?

Solution

I would advise against using Zend_Amf, it was written with some mysterious misconception in mind, which they consider to be the "architecture"... AMFPHP still exists and is maintained by some folks who didn't like Zend that much http://sourceforge.net/projects/amfphp/

Here is their site with examples and explanation on how to set it up etc: http://www.silexlabs.org/amfphp/

OTHER TIPS

I had the same problem once, and solved it as follows.

You can use javascript base64 encoding inside Flash while you can use base64_decode function in PHP. I have used before and it works perfectly.

Take a look at a very reliable PHP extension for encoding/decoding AMF3 streams without the overhead of using pure PHP encoders/decoders - https://github.com/neoxic/php-amf3

Have a look at nekoserver project. It's simplified analogue of amfphp written in Haxe. There you can find nekoserver.amf.io package, look at AmfDeserializer.hx (reading metadata) and Amf3Reader.hx (reading message body). It's all very simple there. Well, I guess the fact that project is written in Haxe is not vey good for you, but you should not be affraid syntax of Haxe is very similar to Actionscript syntax.

Also I recomend to look at AMF format specification.

PS. Did I understood correctly that you need AMF3 (not AMF0)?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top