I have this code here from a previous topic that sknake help solve.
I can't see why its not working.
String^ user = gcnew String(username->Text);
String^ pass = gcnew String(password->Text);
try
{
Uri^ url = gcnew Uri("http://beta.rapidpremium.net/login.php");
String^ data = "username=" + user + "&password=" + pass + "&login=";
HttpWebRequest^ request = dynamic_cast<HttpWebRequest^>(WebRequest::Create(url));
request->Method = "POST";
request->ContentLength = data->Length;
request->ContentType = "application/x-www-form-urlencoded";
StreamWriter^ writer = gcnew StreamWriter(request->GetRequestStream());
writer->Write(data);
writer->Close();
HttpWebResponse^ response = dynamic_cast<HttpWebResponse^>(request->GetResponse());
StreamReader^ reader = gcnew StreamReader(response->GetResponseStream());
String^ tmp = reader->ReadToEnd();
response->Close();
htmlcode->AppendText(tmp);
}
catch (Exception^ ex)
{
//outbox.Text = ex.ToString();
}
and heres what WireShark Gets
POST /login.php HTTP/1.1
Host: beta.rapidpremium.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://beta.rapidpremium.net/login.php
Cookie: PHPSESSID=0c7704fa08d0f24bfa4a3011c73d40a9
Content-Type: application/x-www-form-urlencoded
Content-Length: 44
username=User&password=Pass&login=HTTP/1.1 302 Found
Date: Mon, 18 Jan 2010 22:00:35 GMT
Server: Apache/2
X-Powered-By: PHP/5.2.11
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://beta.rapidpremium.net/usercp.php
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 20
Connection: close
Content-Type: text/html
....................