Advertisement
Guest User

Untitled

a guest
Jun 24th, 2011
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1.   private void button2_Click(object sender, EventArgs e)
  2.         {
  3.  
  4.  
  5.             // this is what we are sending
  6.             string post_data = "type=" + comboBox2.Text + "&subject=" + textBox4.Text + "&name=" + textBox3.Text + "&req=" + textBox5.Text + "&os=" + comboBox1.Text + "&overview=" + textBox7.Text + "&dlink=" + textBox8.Text;
  7.  
  8.             // this is where we will send it
  9.             string uri = "http://localhost/poster.php";
  10.  
  11.             // create a request
  12.             HttpWebRequest request = (HttpWebRequest)
  13.             WebRequest.Create(uri); request.KeepAlive = false;
  14.             request.ProtocolVersion = HttpVersion.Version10;
  15.             request.Method = "POST";
  16.  
  17.             // turn our request string into a byte stream
  18.             byte[] postBytes = Encoding.ASCII.GetBytes(post_data);
  19.  
  20.             request.ContentType = "application/x-www-form-urlencoded";
  21.             request.ContentLength = postBytes.Length;
  22.             Stream requestStream = request.GetRequestStream();
  23.  
  24.             //sending it...
  25.             requestStream.Write(postBytes, 0, postBytes.Length);
  26.             requestStream.Close();
  27.  
  28.  
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement