Sadece bu işlevselliğinin her gerçekleştirmek için kullanmak üst düzey fonksiyonları sağlayan bir Derlenebilir kod olmasa bile ben aşağıda kod PHP eşdeğer arıyorum harika olurdu.
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"];
Böylece temelde aşağıdaki PHP eşdeğer arıyorum
- Bazı özel başlıkları ve içerik türü ile uyumsuz isteği göndermek ve uyumsuz / akışı göndermek
- dizeden bayt bir yük oluşturmak
- yanıt almak ve başlıkları bakmak.