I'm posting JSON data from Angular / Ionic to PHP, but I'm having trouble accessing the data from PHP.
Here is my php code:
$jsonData = file_get_contents('php://input');
$data = json_decode($jsonData, true);
I saved the $jsonData in the database to see what the data looks like and it looks like this:
When I save the json_decode Associative Array to the database, it just saves it as "Array", so I cannot see what the Array looks like. So I echo the data (as response) to Angular and here is what the $data looks like in my browser's console HttpErrorResponse:
"Array↵(↵ [headers] => ↵
[params] => Array↵ …1-12↵ [post_type] => add↵ )↵↵)↵"
There are a few posted data missing from the above response array such as event_title. Maybe the full posted data is there and displayed as "…1-12".
I appreciate any help on this:
- What am I doing wrong in getting the JSON data to Array in PHP code above?
- How do I access the data such as "event_title" in my PHP code?