您好,我目前正在开发一个商业账户系统的集成。以PHP格式获取http请求的字节大小
我需要将http请求中的总字节数发送到我网站上的网址。我的网站是用PHP编写的。
在C#中,它的工作原理如下:但要提及的主要问题是如何在PH中执行此操作,因为似乎无法在此找到有用的文档。在此先感谢
public void ProcessRequest (HttpContext context)
{
context.Response.Buffer = true;
string response = "";
string sMethod = "POST";
//sUrl holds the address to the Verify service, this is a service from AllCharge
// that verifies the signature on the notification. This makes sure that the notification
// was sent by AllCharge.
//Demo server - use this address during the integaration, remark this line when working
// with the live server
string sUrl = "http://demo.allcharge.com/Verify/VerifyNotification.aspx";
//Live server - use this address when working with the live server, remark this line
// during the integration
//string sUrl = "https://incharge.allcharge.com/Verify/VerifyNotification.aspx";
Int32 nCount = context.Request.TotalBytes;
string formParameters = System.Text.Encoding.UTF8.GetString(context.Request.BinaryRead(nCount));
}
是'$ _SERVER ['CONTENT_LENGTH']'你在找什么? – bfavaretto