c# - Post Method in Windows Phone 8 -
I need to send some criteria to a php server using the post method in WP parameters and get feedback in json format .
I have the previous code piece:
public static async zero GetData (string URL, string data) {HTTP Client Client = New HTTP Client (); HttpResponseMessage feedback = client.PostAsync (new URI (url), awaiting new string content); Response.EnsureSuccessStatusCode (); String feedbackBody = awaiting response. Content RedAssressingSync (); MessageBox.Show (responseBody); // just showing the response for now) This shows a message from the server (which is an error stating which fields) it actually communicates with the server but the problem is I am calling the above method:
GetData ("http_address_here", "? Action = registrar & email =asc@fsdf.com& password = 54561wefwe and Firstname = sdfsdf and lastname = sdfsdf and image = 10 "); But I saw an example sending XML data, perhaps calling the fault method. Looking at the tens of the sample code and trying to do everything, I got confused about it. Any help is appreciated.
Finally, I managed to solve the problem. Thanks to everyone, the working code is down, it uses the POST method and the resulting json object is stored as a string.
var value = new list & lt; KeyvaluePair & lt; String, string & gt; & Gt; String, string & gt; ("First name", "cueff"), "new keypiece", "new keywire", "new", "string" gt; ("Email", "qewfwef"), new keypad & lt; String, string & gt; ), New keypad & lt; String, string & gt; ("Last name", "Quoffe"), NewKeyPierce & lt; String, string & gt; ("Picture", "123456")}; Var httpClient = New HTTP client (new HTTP client handler ()); HttpResponseMessage Response = Wait httpClient.PostAsync (URL, New Form URLNcod Contact (Value)); Response.EnsureSuccessStatusCode (); Var response string = await response. Content RedAssressingSync (); MessageBox.Show (responseString.ToString ()); // To see what we get from
Comments
Post a Comment