Php package amf data and send post

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.