• 28-07-2013, 02:50:32
    #1
    Merhaba arkadaşlar vb.net yada c# kullanarak bir php sayfasına nasıl post gönderebilirim ?
  • 28-07-2013, 12:50:17
    #2
    c# için şunu deneyebilirsin..


    HttpWebRequest httpWReq =
        (HttpWebRequest)WebRequest.Create("http://www.site.com/mht.php");
    
    ASCIIEncoding encoding = new ASCIIEncoding();
    string postData = "mail=xxx@hotmail.com&sifre=12345";
    byte[] data = encoding.GetBytes(postData);
    
    httpWReq.Method = "POST";
    httpWReq.ContentType = "application/x-www-form-urlencoded";
    httpWReq.ContentLength = data.Length;
    
    using (Stream stream = httpWReq.GetRequestStream())
    {
        stream.Write(data,0,data.Length);
    }
    
    HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
    
    string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
        MessageBox.Show("İşlem Sonucu: " responseString);
  • 05-08-2013, 00:51:00
    #3
    teşekkürler