I'm trying to process a post request sent from C # code. But so far the working solution has failed ...
I tried to do this:
var values = new Dictionary<string, string> { { "kod", "111" }, { "tupe", "0" }, { "id_user", user.Id }, { "image", encodedFile }, // файл закодированный в base64 { "title", "654321" }, { "text", "1234526" } }; var jsonString = JsonConvert.SerializeObject(values); var content = new System.Net.Http.StringContent(String, Encoding.UTF8, "application/json"); var response = await client.PostAsync("http://.php", content); var responseString = await response.Content.ReadAsStringAsync(); But in this dispatch, I never figured out how to receive it not on the server. Because of "application / json".
Next tried this:
var String = "kod=111&tape=0&id_user=" + user.Id + "&image=" + encodedFile + "&title=123&text=dfgdg"; var content = new System.Net.Http.StringContent(String, Encoding.UTF8, "application/json"); var response = await client.PostAsync("http://plus-you.ru/mobile/tape_v_2.php", content); var responseString = await response.Content.ReadAsStringAsync(); But now, when received on the server in the coded text, for some reason, some characters changed, making it impossible to decode the file back ...
Found many options with WebClient for example. In my Visual Studio 2015, for some reason, WebClient is not recognized at all ...
I need to either figure out how to handle this Json using PHP on the server, or figure out how to send so that the base64 characters do not change, or some other guidance on the true path ...