How do I read all the users from this POST.
{
"refId":"455",
"users": [
{
"name":"tom",
"address":"adres1",
"city":"city1"
},
{
"name":"JAck",
"address":"adres2",
"city":"city3"
}
]
}
the 'refId' I get like this
$data = json_decode( file_get_contents( "php://input" ) );
$refID = $data->refId;
I there is only one user I read like this
$userName = $data->users->name;
$userAddress = $data->users->address;
$usercity = $data->users->city;
But when there are 2 or more users, I get stuck... probably a 'foreach' but I can't figure it out..