HTTP POST using tcpclient

Hello,

can anybody show me how to request an HTTP POST using tcpclient

I need to use only tcpclient ...

thanks for any help




Answer this question

HTTP POST using tcpclient

  • IS dude

    What have you tried so far An HTTP request isn't more than writing a couple of lines (request line and eventual headers)... The exact content requirements are described here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5




  • ErrolDC

    There are a lot of examples availble on the internet to do with. I would recomend you giving it a try to search it using google.

    Best Regards,

    Rizwan aka RizwanSharp



  • KAllbritain

    Hello

    thank you for your answers...

    I tried many samples but unfortunately without success...

    it is the first time i do this kind of thing

    if anybody can provide me an URL or a small sample code

    thanks a lot



  • Jeff Green

    tcpClient.Connect("www.timvw.be", 80);

    using (NetworkStream networkStream = tcpClient.GetStream())
    {
     using (StreamWriter streamWriter = new StreamWriter(networkStream))
     {
      // request line
      streamWriter.Write("POST /test/post.php HTTP/1.0\r\n");

      // headers
      streamWriter.Write("Host: www.timvw.be\r\n");
      streamWriter.Write("Content-Type: application/x-www-form-urlencoded\r\n");
      streamWriter.Write("Content-Length: 32\r\n");
      streamWriter.Write("\r\n");

      // body
      streamWriter.Write("home=Cosby&favorite+flavor=flies\r\n");
      streamWriter.Flush();
     }
    }


  • cisco0407

    Thanks a lot

  • HTTP POST using tcpclient