How to serialize AMF responses using AMFPHP?

484 views Asked by At

I've tried using a method I've seen and editing it to fit my environment.

require_once( 'amfphp/core/amf/app/Gateway.php'); require_once( AMFPHP_BASE . 'amf/io/AMFSerializer.php');

$data = array('message' => 'Hello, world!')

$serializer = new AMFSerializer(); $serializer->writeAmf3Data( $data );

print $serializer->outBuffer;

But nothing seems to work for me. Anyone know how to go about serializing AMF using AMFPHP without the gateway?

1

There are 1 answers

3
Ariel Sommeria-Klein On

With Amfphp 2.2.1 :

require_once( 'Amfphp/ClassLoader.php');
$serializer = new Amfphp_Core_Amf_Serializer();
$message = new Amfphp_Core_Amf_Message('/1/onResult', null, $data);
$packet = new Amfphp_Core_Amf_Packet();
$packet->messages[] = $message;
echo $serializer->serialize($packet);