To debug this we would need to see the data received from the server before you try to parse it via JSONSerialization.
Is the line 1 bytes the output from calling print(data)? That would definitely not be the valid JSON you are looking for.
Now admittedly I have no experience with PHP, but I must wonder if this line does what the comment says it does:
// Finally, encode the array to JSON and output the results
echo utf8_encode($resultArray);
Topic:
Programming Languages
SubTopic:
Swift
Tags: