0

I've been attempting to read in a JSON dictionary from Swift through PHP and display the results.

So far, I have been able to send the dictionary in the form {location: "North America", Name: "Me"} to the server correctly using a POST method.

My problem is reading in the content and displaying it.

My PHP code is:

<?php
$json = file_get_contents('php://input');
$value = json_decode($json);

var_dump($value);
?>

Whenever I run the script, I get a 500 server error. Any help would be appreciated.

Sebastian Wozny
  • 16,943
  • 7
  • 52
  • 69

1 Answers1

0

Per php.net: php://input is not available with enctype="multipart/form-data". Did you check your request headers?

MikeWu
  • 3,042
  • 2
  • 19
  • 27