如何从php中的httpcontext接受和读取数据?

时间:2016-02-29 09:26:43

标签: php httpwebrequest httphandler

我想添加一个用PHP编写的页面来处理HTTP请求,并回答它们。 我想要的只是一个类似下面代码的页面:

    <%@ WebHandler Language="C#" Class="Handler" %> 
using System;
using System.Web; 
public class Handler : IHttpHandler {    
    public void ProcessRequest (HttpContext context) {
        //context.Response.read
        context.Response.ContentType = "text/plain";
        //context.Response.Write("Hello World");
        byte[] x = context.Request.BinaryRead(context.Request.ContentLength);

        context.Response.Write("Your message will be read soon!");
    } 
    public bool IsReusable 
    {
        get {
            return false;
        }
    }
}

0 个答案:

没有答案