sde
Well-known member
all i want to do is send post variables to a php script from a c# windows app: can anyone tell me where im going wrong?
the php page im sending too looks for POST variables named username and password
if i hard code something on that php page, it does show up in my message box, however it is not recognizing anything in the post variable. ( the same as this.Request.Form[username] in asp.net )
the php page im sending too looks for POST variables named username and password
if i hard code something on that php page, it does show up in my message box, however it is not recognizing anything in the post variable. ( the same as this.Request.Form[username] in asp.net )
Code:
WebRequest wrq;
WebResponse wrs;
string strPostVars = "action=auth&username="+this.txtUsername.Text+"&password="+this.txtPassword.Text;
wrq = WebRequest.Create("http://domain.com/authenticate/index.php");
wrq.Method="POST";
StreamWriter sw = new StreamWriter(wrq.GetRequestStream());
sw.Write(strPostVars);
sw.Close();
wrs = wrq.GetResponse();
StreamReader sr = new StreamReader(wrs.GetResponseStream());
MessageBox.Show(sr.ReadLine());