Php encapsulates amf data, sends post analog client requests, AMF requests & nbsp; packets. Currently, only C # is available. I have never learned C # and want to translate it into a php version, but it hurts a lot. Do you have a class library with similar functions on the Internet? Or code with the same function already exists? Class & nbsp; AMF_Post_Data & nbsp; & php encapsulate amf data and send post
Simulate client requests and AMF Request Packets. Currently, only the C # version is available. I have never learned C # and want to translate it into a php version, but it hurts a lot. Do you have a class library with similar functions on the Internet? Or code with the same function already exists?
Class AMF_Post_Data
{
Public List
Message;
///
/// Initialize Message
///
///
///
///
Public AMF_Post_Data (AMFType at, int headers, int bodies)
{
// AMF version
If (at = AMFType. AMF0)
{
Message = new List
(New byte [] {0x00, 0x00 });
}
Else if (at = AMFType. AMF3)
{
Message = new List
(New byte [] {0x00, 0x03 });
}
// Number of headers
Message. Add (BitConverter. GetBytes (headers) [1]);
Message. Add (BitConverter. GetBytes (headers) [0]);
// Number of bodies
Message. Add (BitConverter. GetBytes (bodies) [1]);
Message. Add (BitConverter. GetBytes (bodies) [0]);
}
///
/// Add Target
///
///
///
Public void AddTargetAndResponse (string target, string Response)
{
// Add the Target length
Message. Add (BitConverter. GetBytes (target. Length) [1]);
Message. Add (BitConverter. GetBytes (target. Length) [0]);
// Add Target content
Message. AddRange (Encoding. Default. GetBytes (target ));
// Add the Response length
Message. Add (BitConverter. GetBytes (Response. Length) [1]);
Message. Add (BitConverter. GetBytes (Response. Length) [0]);
// Add Response content
Message. AddRange (Encoding. Default. GetBytes (Response ));
}
///
/// Add the Body
///
///
///
Public void AddBody (AMF_Post_Data_Body apdb)
{
Message. AddRange (apdb. getLength ());
Message. AddRange (apdb. Content. ToArray ());
}
}
Class AMF_Post_Data_Body