public void Post(UserAnswer userAnswer) { /*WebClient webClient = new WebClient(); * Uri url = new Uri("http://192.168.1.14/app_dev.php/api/answers/users/new"); * * string JsonStringParams = "{'idQuestion':'" + userAnswer.idQuestion + "','idAnswer':'" + userAnswer.idAnswer + "','idQcm':'"+userAnswer.idQcm+"'}"; * webClient.UploadStringCompleted += wc_UploadStringCompleted; * webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded"; * webClient.Encoding = Encoding.UTF8; * webClient.UploadStringAsync(url, "POST", JsonStringParams);*/ WebClient wc = new WebClient(); Uri url = new Uri("http://192.168.1.14/app_dev.php/api/answers/users/new"); wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted); wc.Headers["Content-Type"] = "application/x-www-form-urlencoded"; wc.Encoding = Encoding.UTF8; Parameters prms = new Parameters(); prms.AddPair("idQuestion", userAnswer.idQuestion.ToString()); prms.AddPair("idAnswer", userAnswer.idAnswer.ToString()); prms.AddPair("idQcm", userAnswer.idQcm.ToString()); wc.UploadStringAsync(url, "POST", prms.FormPostData(), null); }