October 13th, 2009, 05:16 PM
C++ Http request?
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.
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);
res = request.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
Response = sr.ReadToEnd();
October 14th, 2009, 09:29 AM
Re: C++ Http request?
Take a look at the wininet API. There are similar API functions for your .NET versions.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.