I transferred a JSONArray from my android app to my php file and when I echo it on the php file it echo's back "Array" but I can't seem to access the contents of the array.
Here is part of my php file:
$data = json_decode(file_get_contents('php://input'), true);
$orderJSON = urldecode($_POST['order']);
$orderJSON = json_decode($orderJSON,true);
// Create connection
$conn = mysqli_connect($servername, $username, $password2, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo $orderJSON;
I cant seem to access the contents, they all return null, I used the following to encode the JSONArray on android.
String jsonPost = URLEncoder.encode("order","UTF-8")+"="+URLEncoder.encode(jsonArray.toString(),"UTF-8");
I have double check if the array has data before posting it through and it does display the loaded contents, even on the php file it echo's the contents when I comment out the json_decode() method
print_r($orderJSON);?