Good day. Help me figure out how to pass json from Xamarin.forms to php?
I followed the example of the code indicated on this link: http://metanit.com/sharp/xamarin/10.3.php
HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(); request.RequestUri = newUri("http://path.ru/mobile_create_PDF_entrante.php"); request.Method = HttpMethod.Post; request.Content = content; HttpResponseMessage response = await client.SendAsync(request); And I wrote json data in the class, which I send to php:
string json = @"{ FIO: '" + Form_Entrant.Entry_FIO.Text + "' " + ", Residence_Address: '" + Form_Entrant.Entry_Residence_Address.Text + "' " + ", Passport_Series: '" + Form_Entrant.Entry_Passport_Series.Text + "' " + ", Passport_Number: '" + Form_Entrant.Entry_Passport_Number.Text + "' " + ", Place_Residence: '" + Form_Entrant.Entry_Place_Residence.Text + "' " + ", Data_Give_Out: '" + Form_Entrant.Entry_Data_Give_Out.Text + "' " + ", Photo_Signature: '" + Photo_Signature_Base64 + "' " + ", Now_Date: '" + Now_Date.Text + "' }"; But I have no idea how to get encrypted json in php.
$_POSTarray. Everything you send is stored in it. In general, why not useusing(WebClient client = new WebClient()) {....}- And$_POSTshould I get the json variable, not FIO, Residence_Address, etc.? Since if I understand correctly, you need to do morejson_decode($json)in order to use FIO objects, Residence_Address, etc. - D.DanteWebClientfor Xamarin is most likely not suitable, because it's outdated,HttpClientcome to replace it - Bulsonvar_dump($_POST)orprint_r($_POST)and add your question what you received, and I will make the correct answer. @Bulson, got it. well http is dearer. - And$_POSToutput to the .txt file and got an empty POST. I do not quite understand what could be the reason for getting an empty POST? - D.Dante