Can someone fix me how to insert the separation keys of the items?
$url = "http://www.ffcv.es/ncompeticiones/server.php?action=getActa&tmp=2017/2018&jor=3&cmp=48&idl=0201073211&idv=0201128231&id=2127995";
$data = file_get_contents($url);
$array = json_decode($data, true);
$result = [];
foreach($array as $colors => $color){
if($colors == "amonestacionesLocal"){
foreach($color as $key => $value){
foreach($value as $clave => $valor){
$result[]=$valor;
}
}
}
if($colors == "amonestacionesVisitante"){
foreach($color as $key => $value){
foreach($value as $clave => $valor){
$result[]=$valor;
}
}
}
}
echo json_encode($result);
That's how I get it:
[
{
"valor": "634cef1b26b8a95c7229788b610b02bbf8ba7c8b",
"idJugador": "Nombre del jugador"
},
{
"valor": "Montesinos Piedra, Jaime",
"idJugador": "Nombre del jugador"
},
{
"valor": "amarilla",
"idJugador": "Nombre del jugador"
},
{
"valor": "53'",
"idJugador": "Nombre del jugador"
},.......