Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# PHP等效于异步HttpWebRequest上的.net/C代码,自定义头文件二进制负载和分析响应_C#_Php_.net_Wcf - Fatal编程技术网

C# PHP等效于异步HttpWebRequest上的.net/C代码,自定义头文件二进制负载和分析响应

C# PHP等效于异步HttpWebRequest上的.net/C代码,自定义头文件二进制负载和分析响应,c#,php,.net,wcf,C#,Php,.net,Wcf,我正在寻找下面代码的PHP等价物,即使它不是一个可编译的代码,只要提供用于执行这些功能的高级函数就好了 因此,基本上我正在寻找以下PHP等价物 发送一个带有一些自定义头和内容类型的异步请求,并以异步/流方式发送 从字符串中创建以字节为单位的有效负载 获取响应并查看标题。 方法是在设置中使用curl: CURLOPT_WRITEFUNCTION 卷发头功能 我认为它们允许使用回调函数进行异步通信。不是100%肯定 方法是在设置中使用curl: CURLOPT_WRITEFUNCTION 卷发头功能

我正在寻找下面代码的PHP等价物,即使它不是一个可编译的代码,只要提供用于执行这些功能的高级函数就好了

因此,基本上我正在寻找以下PHP等价物

发送一个带有一些自定义头和内容类型的异步请求,并以异步/流方式发送 从字符串中创建以字节为单位的有效负载 获取响应并查看标题。
方法是在设置中使用curl:

CURLOPT_WRITEFUNCTION 卷发头功能 我认为它们允许使用回调函数进行异步通信。不是100%肯定


方法是在设置中使用curl:

CURLOPT_WRITEFUNCTION 卷发头功能 我认为它们允许使用回调函数进行异步通信。不是100%肯定


这里有一些函数,我想它会回答你的问题 卷曲: FSOCKOPEN: 文件\u获取\u内容:
获取标题:

这里有一些函数,我想它会回答您的问题 卷曲: FSOCKOPEN: 文件\u获取\u内容: 获取标题:

        string subscriptionUri = "sample.com";
        HttpWebRequest sendNotificationRequest = (HttpWebRequest)WebRequest.Create(subscriptionUri);
        sendNotificationRequest.Method = "POST";

        sendNotificationRequest.Headers.Add("X-MessageID", "<UUID>");
        sendNotificationRequest.ContentType = "text/xml";


        sendNotificationRequest.ContentLength = notificationMessage.Length;
        byte[] notificationMessage = new byte[] {<payload>};

        using (Stream requestStream = sendNotificationRequest.GetRequestStream())
        {
           requestStream.Write(notificationMessage, 0, notificationMessage.Length);
        }

        // Sends the notification and gets the response.
        HttpWebResponse response = (HttpWebResponse)sendNotificationRequest.GetResponse();
        string notificationStatus = response.Headers["X-NotificationStatus"];
        string notificationChannelStatus = response.Headers["X-SubscriptionStatus"];
        string deviceConnectionStatus = response.Headers["X-DeviceConnectionStatus"];