C# ile xml post etme
SanalData’yı Google’da tercih edilen kaynak olarak ekleyinMerhaba arkadaşlar belki sizlere lazım olabilir c# ile belirtilen url ye xml post etme işlemi öncelikle aşağıdaki kütüphaneleri include ediyoruz.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; using System.Configuration; using System.Net; using System.Text.RegularExpressions; using System.Data.SqlClient; using System.IO; using Microsoft.Win32; using System.Web; |
Daha sonra post edicek kodlarımız ise aşağıdaki gibidir ;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
xml="<SingleTextSMS>"; xml += "<UserName>test</UserName>"; xml += "<PassWord>test</PassWord>"; //xml post başla string webpageContent = string.Empty; try { byte[] byteArray = Encoding.UTF8.GetBytes("data="+xml); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("url adresi"); webRequest.Method = "POST"; webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.ContentLength = byteArray.Length; using (Stream webpageStream = webRequest.GetRequestStream()) { webpageStream.Write(byteArray, 0, byteArray.Length); } using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) { using (StreamReader reader = new StreamReader(webResponse.GetResponseStream())) { webpageContent = reader.ReadToEnd(); } } } catch (Exception ex) { webpageContent = ex.Message; } MessageBox.Show(webpageContent); |
Günün zaman çizelgesi
Haber eklenme saatine göre sıralanır.
- Bugün
- Telefon Çekmiyorsa Deneyebileceğiniz Çözümler
- IPTV Nedir? Yasal Yayınlarla Kaçak Servis Arasındaki Fark
- Windows 11 Çalıştır penceresi yenileniyor: Gözat yok
- Apple TV 4K’da 8 GB RAM var, uygulama sınırı 2 GB
- Gemini Docs ve Sheets dosyalarını sohbet içinde düzenliyor
- The Witcher 4 için 2028 çıkış iddiası yeniden gündemde
- Dün
- Akıllı gözlükler mahkeme, okul ve havuzlarda yasaklanıyor
- Expert RAW, Galaxy S27 ile 30 kare DNG çekebilecek
- Fuelio, Android Auto’da yakıt fiyatlarını karşılaştırıyor
- COMAC’ın elektrikli uçağı CE-25A mürettebatla uçtu
- Cloudflare, yapay zekâ ajanları için Kitesurf’ü açtı
- BMW M 1000 RS tanıtıldı: 215 beygir, 196 kg
- GTA 6’nın hikâyesi 50 saat, platin kupası 200 saat sürebilir
- SİPER Ürün-2’nin menzili 150 kilometreyi aşıyor