C++ Http request?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: C++ Http request?

  1. #1
    Join Date
    Jun 2009
    Posts
    118

    C++ Http request?

    Code:
     string Response = "LOGIN_UNSUCCESSFUL";
                    System.Net.WebRequest request = System.Net.WebRequest.Create("http://mywebsite.com/user.php");
                    string postData = "&do=login&vb_login_username=" + Username.Text + "&vb_login_password=" + Password.Text  + "&HWID=" + GETHW.HWID;
                    byte[] send = Encoding.Default.GetBytes(postData);
                    request.Method = "POST";
                    request.ContentType = "application/x-www-form-urlencoded";
                    request.ContentLength = send.Length;
                    Stream sout = request.GetRequestStream();
                    sout.Write(send, 0, send.Length);
                    sout.Flush();
                    sout.Close();
                    WebResponse res;
                    try
                    {
                        res = request.GetResponse();
                        StreamReader sr = new StreamReader(res.GetResponseStream());
                        Response = sr.ReadToEnd();
                    }
    I need to find some libraries for C++ to request a response like this C# program I made does. It sends the request with the specified data, then the script runs, echos a response and the program takes the response and uses it.

    Thanks.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: C++ Http request?

    Take a look at the wininet API. There are similar API functions for your .NET versions.

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center