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.

  • In php there is a special super global $_POST array. Everything you send is stored in it. In general, why not use using(WebClient client = new WebClient()) {....} - And
  • WebClient - I do not use it because I do not know which library to add to NuGet for sure. Can I clarify the following in php using $_POST should I get the json variable, not FIO, Residence_Address, etc.? Since if I understand correctly, you need to do more json_decode($json) in order to use FIO objects, Residence_Address, etc. - D.Dante
  • @And WebClient for Xamarin is most likely not suitable, because it's outdated, HttpClient come to replace it - Bulson
  • @ D.Dante, that's why I say, so that you can see, do var_dump($_POST) or print_r($_POST) and add your question what you received, and I will make the correct answer. @Bulson, got it. well http is dearer. - And
  • I made a $_POST output 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

0