您好,我目前正在開發一個商業賬戶系統的集成。以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