please help me i want get a website code code ,use the post method
this is my code
but get code is NULL ,I do not know where the error occurred
this is my code
string postData = "name = aaaaaaaa"; byte[] byteArray = Encoding.UTF8.GetBytes(postData); HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create("http://baidu.lecai.com/user/user_exist.php"); objWebRequest.Method = "POST"; objWebRequest.ContentType = "application/x-www-form-urlencoded"; objWebRequest.ContentLength = byteArray.Length; Stream newStream = objWebRequest.GetRequestStream(); // Send the data. newStream.Write(byteArray, 0, byteArray.Length); newStream.Close(); HttpWebResponse response = (HttpWebResponse)objWebRequest.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default); string textResponse = sr.ReadToEnd(); MessageBox.Show(textResponse);
but get code is NULL ,I do not know where the error occurred