|
Mailing Lists
|
Home /
Groups /
.NET Technical Talk (Net-Talk)
Form Post Result
I am try to send data via a post to a third party server. The code I amDuane 06/04/08 11:46 A Duane,Nathan Strutz 06/04/08 12:26 P I am try to send data via a post to a third party server. The code I am using is below. I can't really tell if the post is working properly, is there a way to get the data that the third party site is returning in the post? Thanks, Duane ASCIIEncoding encoding = new ASCIIEncoding(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://localhost/app/view:Join/signupId: 12587"); string postData = ""; postData += "member_id="; postData += "&prev_member_email="; postData += "&signup_name=none"; postData += "&private_set=2"; postData += "&groups[]=4352,6389"; byte[] data = encoding.GetBytes(postData); req.Method = "POST"; req.ContentType = "application/x-ww-form-urlencoded"; req.ContentLength = data.Length; Stream reqStream = req.GetRequestStream(); // Send the data. reqStream.Write(data, 0, data.Length); reqStream.Close(); Duane, You made a WebRequest, now get the WebResponse: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.getresponse.aspx HttpWebResponse response = (HttpWebResponse) req.GetResponse(); Then you can get the HTTP status code of your request, as well as stream the returned data (probably HTML ?) into your app. Hope that helps... hope it's right... only done it once. -- nathan strutz http://www.dopefly.com/ ----- Excess quoted text cut - see Original Post for more -----
|
May 21, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||