Hey guys. I am trying to post a string to a webpage on my server, but I am not sure how to do it. I have tried peicing some code together from what I have read on the net, but I cannot find any real examples.
Has anyone done this?
Here is some crap code I am trying to get to work, but I am not realy sure what I am doing here since I have never done anything like this before.
[code]
string sql = "INSERT INTO tblWhatever (field1,field2) VALUES ('1','2')";
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://www.mywebsite.com/mypage.php");
myReq.Method =
"POST";
myReq.ContentType =
"application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(myReq.GetRequestStream());
writer.Write(sql);
writer.Close();
[/code]
Thanks for any input!