C# - Json POST request sent but not received by PHP server

前端 未结 1 2033
生来不讨喜
生来不讨喜 2021-01-25 04:11

I am sending a HTTP request from a C# windowsform application to PHP server hosted on OpenShift (Redhat). I am using the method POST, with Json data.

The problem is that

相关标签:
1条回答
  • 2021-01-25 04:37

    PHP's $_POST does not understand JSON.

    What you want is something along the lines of

    // Error handling is left as an exercise
    $input = json_decode(file_get_contents('php://input'), true);
    

    You should then be able to use $input the way you seem to want to use $_POST. See json_decode for additional knobs to twiddle.

    0 讨论(0)
提交回复
热议问题