8771 sujets

Développement web côté serveur, CMS

Pages :
(reprise du message précédent)

Hourraaaaaaaaaa ça marche, hormis le contenu de $response, je n'ai plus que les bonnes données que je souhaitais extraire (et sans message d'erreurs lol).
Bravo et merci beaucoup, tu as bien du te prendre la tête sur le code, c'est super gentil .
Moi avec mon expérience de débutant je n'étais pas prêt de le trouver celui la !!! Smiley confused
Juste une question, en terme niveau de developpement, le code que tu viens de me trouver c'est quel niveau ? developpeur junior ? developpeur senior ? ingénieur ? pape du dev ?
Modérateur
Bonjour,
michel4-7 a écrit :
Juste une question, en terme niveau de developpement, le code que tu viens de me trouver c'est quel niveau ? developpeur junior ? developpeur senior ? ingénieur ? pape du dev ?

Débutant ! Smiley lol Smiley lol Smiley lol

Bon, j'exagère un peu.

Normalement, tu dois pouvoir y arriver tout seul assez vite. Il faut juste comprendre la syntaxe pour un objet, un tableau, ce que c'est qu'un json (tu n'échapperas à la nécessité de comprendre dans le détail comment sont structurées les données de ton $response), et éventuellement quand il y a une erreur savoir interpréter ce que dit le message (là, c'est un peu plus long, il faut un peu d'expérience). Et après, bah, c'est juste une question de logique.

Ça dépend aussi si tu connais d'autres langages de programmation ou bien si c'est ton premier. Si tu n'as jamais codé avant, ça demande de la pratique évidemment.

Amicalement,
En fait je pose la question car je sors d'une formation de webdev de niveau 5 (equivalence bac+2) mais ça je n'aurai pas su le trouver. Donc soit c'est normal soit il faut que je m'inquiète
Modérateur
Bonjour,
michel4-7 a écrit :
En fait je pose la question car je sors d'une formation de webdev de niveau 5 (equivalence bac+2) mais ça je n'aurai pas su le trouver. Donc soit c'est normal soit il faut que je m'inquiète

Ha ouais, quand même ! Et ben ! Smiley cligne

À vrai dire, je ne me rends pas bien compte de ce que peut-être le niveau de quelqu'un qui sort de l'école. C'est tellement lointain pour moi ! Et je n'ai pas trop l'occasion d'en rencontrer (je veux dire par là que je n'en croise pas des wagons tous les jours).

Est-ce normal ou dois-tu t'inquiéter ? Je ne pense pas que tu doives t'inquiéter. Je ne connais qu'une seule recette : du travail, encore du travail, toujours du travail, et on finit par y arriver.

Amicalement,
Bonjour,
Je reviens à la charge avec mon API mdr le boulet ...
J'aimerai savoir s'il y a une commande qui permet de lister le $response de façon à ce que ce soit plus lisible.
En fait ce que tu m'as fait avec les buteurs j'essaie de le refaire avec les cartons jaunes mais les contenu de $response est tellement difficile a lire que je n'y arrive pas.
J'aimerai le faire moi-même, je m'inspire de ton code, je le décortique mais le contenu de $response est tellement fastidieux que je me perds

Merci
Modifié par michel4-7 (02 Nov 2020 - 18:37)
Modérateur
Bonjour,

Comme la maison ne recule devant aucun sacrifice, voilà un code qui affiche $response sous forme de liste indentée.

A priori, ça devrait être un peu plus lisible. Quand tu vois un nombre suivi de ":", ça veut dire que c'est un élément de tableau. Sinon, c'est une propriété d'objet.


$response2=json_decode($response);
function print_prop_and_val($a)
{
	echo "<details style='padding-left:2rem;'>";
	foreach ($a as $name => $value)
	{
		if(is_array($value)||is_object($value))
		{
			echo "<div style='padding-left:2rem;'>$name: ";
			print_prop_and_val($value);
			echo "</div>";
		}
		else echo "<div style='padding-left:2rem;'>$name: $value</div>";
	}
	echo "</details>";
}
print_prop_and_val($response2);


Amicalement,
Modifié par parsimonhi (02 Nov 2020 - 20:20)
Modérateur
Bonjour,

Le script, c'est juste pour que tu puisses afficher pour toi la "response" d'une manière à peu près lisible.

Code complet sur une page (amélioré), en supposant que tu aies mis le contenu de $response dans un fichier s'appellant "matches.txt".
<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php 
$response=file_get_contents("matches.txt");
$response2=json_decode($response);
function print_prop_and_val($a,$n=0)
{
	if(!$n) echo "<details><summary>Matches</summary>";
	foreach ($a as $name => $value)
	{
		if(is_array($value)||is_object($value))
		{
			echo "<details style='padding-left:2rem;'>";
			echo "<summary>$name: </summary>";
			print_prop_and_val($value,1);
			echo "</details>";
		}
		else echo "<div style='padding-left:2rem;'>$name: $value</div>";
	}
	if(!$n) echo "</details>";
}
print_prop_and_val($response2);
?> 
</body>
</html>

Amicalement,
Merci maintenant ça semble fonctionner.
Oui je souhaitais afficher le contenu de $response juste pour moi
Juste pour être sur, cela affiche des triangles que l'on doit dérouler nous même pour voir l'aborescence des données ?
Modifié par michel4-7 (02 Nov 2020 - 20:49)
Modérateur
Bonjour,
michel4-7 a écrit :
Merci maintenant ça semble fonctionner.
Oui je souhaitais afficher le contenu de $response juste pour moi
Juste pour être sur, cela affiche des triangles que l'on doit dérouler nous même pour voir l'aborescence des données ?

Oui (c'est la balise html <details> qui permet de faire ça).

J'ai fait cette présentation car comme ça, tu peux déplier (et replier) uniquement ce qui t'intéresse et cacher le reste. Sinon, on obtient une page énorme, et c'est assez difficile de s'y retrouver quand on arrive en bas de page.

Du coup, ça permet de rechercher dans l'arborescence des propriétés celle qui t'intéresse, et de ce fait de voir le chemin qui y conduit.

Amicalement,
Bonjour,
Bon bien j'ai essayé de mettre en place l'affichage des cartons et cela ne fonctionne pas (je poste quitte a passer pour un clown. Rester sur une erreur ce n'est pas l'idéal, j'apprends).
C'est la première fois que je bosse sur une API bien ce n'est pas facile.
Mon editeur ou ma console ne m'indique aucune erreur.
J'ai créé un autre boucle foreach dans laquelle j'ai dû déconner, le navigateur ne voit pas le echo. Je n'ai aucun message d'erreur, c'est juste qu'il n'affiche rien.
Voici mon code que j'ai mis dans la 1ere boucle foreach (en fait à la suite des autres boucles)

$sanctions = $match->penalties;
foreach($sanctions as $sanction)
{
if(property_exists($sanction,'penalty_level')
&&property_exists($sanction->penalty_level,'yellow-card')
)
echo "Avertissements pour : ".$sanction->penalty_level->{'yellow-card'};
}


Merci
Modifié par michel4-7 (03 Nov 2020 - 09:10)
Modérateur
Bonjour,

"Yellow-card" est une valeur (en l'occurence la valeur de $sanction->penalty_level), pas une propriété.

Le nom des joueurs ayant reçu un carton est accessible via $sanction->player->full :
$sanctions = $match->penalties;
foreach($sanctions as $sanction)
{
	if(property_exists($sanction,'player')
	&&property_exists($sanction->player,'full')
	&&property_exists($sanction,'penalty_level')
	&&($sanction->penalty_level=="yellow-card"))
	echo "Avertissements pour : ".$sanction->player->full."<br>";
}

Amicalement,

PS: j'ai encore un peu amélioré la fonction qui affiche l'arborescence. Voici cette nouvelle version
function print_prop_and_val($a,$n=0)
{
	if(!$n) echo "<details><summary>Matches</summary>";
	foreach ($a as $name => $value)
	{
		if(is_array($value)||is_object($value))
		{
			echo "<details style='padding-left:2rem;'>";
			echo "<summary>";
			if(preg_match("/^[0-9]+$/",$name)) echo "[$name]";
			else echo "$name";
			if(is_object($value)) echo "-&gt;";
			echo "</summary>";
			print_prop_and_val($value,1);
			echo "</details>";
		}
		else echo "<div style='padding-left:2rem;'>$name: $value</div>";
	}
	if(!$n) echo "</details>";
}
print_prop_and_val($response2);

Modifié par parsimonhi (03 Nov 2020 - 09:40)
Je reviens à la charge avec mon API (encore et toujours). Il y a certaines choses que j'arrive a faire et d'autres qui me plantent totalement ... j'essaie d'afficher les buteurs via scores (qui me convient mieux que le précédent car on peut avoir le détail des buteurs et afficher le minutage...

Pour cette portion de données
[{"city":"Leipzig","home_team":{"players":[{"status":"starter","full":"Péter Gulácsi","last":"Gulácsi","time_played_total":"90","uniform_number":"1","stats":{"touches":"44","stats_soccer_defensive":{"clearances-successful":"1","saves":"1","goals-against-total":"1","catches-punches":"1","save-percentage":"0.083"},"stats_soccer_foul":{},"stats_defensive":{"save_percentage":"0.083","saves":"1","goals_against_total":"1","catches_punches":"1","clearances_successful":"1"},"stats_soccer_offensive":{"passes-total":"39","passes-complete-3rd-final":"2","passes-complete-long":"10","passes-complete":"25","passes-incomplete":"14"},"stats_foul":{},"stats_offensive":{"passes_complete":"25","passes_complete_long":"10","passes_complete_3rd_final":"2","passes_total":"39","passes_incomplete":"14"}},"position":"goalkeeper","first":"Péter"},{"status":"starter","full":"Ibrahima Konaté","last":"Konaté","time_played_total":"90","uniform_number":"6","stats":{"touches":"65","stats_soccer_defensive":{"clearances-successful":"2","goals-against-total":"1","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"7","tackles-total":"1","passes-total":"58","tackles-lost":"0","passes-incomplete":"10","passes-complete-long":"4","tackles-won":"1","passes-complete":"48"},"stats_soccer_foul":{"fouls-commited":"3","cautions-total":"1"},"stats_defensive":{"goals_against_total":"1","interceptions":"1","clearances_successful":"2"},"aerials_won":"2","stats_foul":{"fouls_commited":"3","cautions_total":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"48","passes_total":"58","passes_incomplete":"10","passes_complete_3rd_final":"7","passes_complete_long":"4","tackles_won":"1"}},"position":"defender","first":"Ibrahima"},{"status":"starter","full":"Dayot Upamecano","last":"Upamecano","time_played_total":"90","uniform_number":"5","stats":{"touches":"52","stats_soccer_defensive":{"clearances-successful":"4","goals-against-total":"1","shots-penalty-shot-allowed":"1","interceptions":"1","shots-blocked-outfielder":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"4","tackles-total":"4","passes-total":"38","tackles-lost":"1","passes-incomplete":"10","passes-complete-long":"3","tackles-won":"3","passes-complete":"28"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"1","cautions-total":"1"},"stats_defensive":{"shots_blocked_outfielder":"1","shots_penalty_shot_allowed":"1","goals_against_total":"1","interceptions":"1","clearances_successful":"4"},"aerials_won":"5","stats_foul":{"fouls_commited":"2","fouls_suffered":"1","cautions_total":"1"},"stats_offensive":{"tackles_lost":"1","tackles_total":"4","passes_complete":"28","passes_total":"38","passes_incomplete":"10","passes_complete_3rd_final":"4","passes_complete_long":"3","tackles_won":"3"}},"position":"defender","first":"Dayot"},{"status":"starter","full":"Willi Orban","last":"Orban","time_played_total":"90","uniform_number":"4","stats":{"touches":"70","stats_soccer_defensive":{"clearances-successful":"3","goals-against-total":"1","interceptions":"1","shots-blocked-outfielder":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"4","tackles-total":"6","passes-total":"44","tackles-lost":"4","passes-incomplete":"10","passes-complete-long":"2","tackles-won":"2","passes-complete":"34","crosses-18-yard":"1"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"1"},"stats_defensive":{"shots_blocked_outfielder":"1","goals_against_total":"1","interceptions":"1","clearances_successful":"3"},"aerials_won":"5","stats_foul":{"fouls_commited":"1","fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"4","tackles_total":"6","passes_complete":"34","passes_total":"44","passes_incomplete":"10","crosses_18_yard":"1","passes_complete_3rd_final":"4","passes_complete_long":"2","tackles_won":"2"}},"position":"defender","first":"Willi"},{"status":"starter","full":"Nordi Mukiele","last":"Mukiele","time_played_total":"64","uniform_number":"22","stats":{"touches":"77","stats_soccer_defensive":{"goals-against-total":"1","interceptions":"5"},"stats_soccer_offensive":{"passes-complete-3rd-final":"5","tackles-total":"1","passes-total":"42","tackles-lost":"1","passes-incomplete":"18","tackles-won":"0","passes-complete":"24","crosses-18-yard":"1"},"stats_soccer_foul":{"fouls-suffered":"3"},"stats_defensive":{"goals_against_total":"1","interceptions":"5"},"aerials_won":"2","stats_foul":{"fouls_suffered":"3"},"stats_offensive":{"tackles_lost":"1","tackles_total":"1","passes_complete":"24","passes_incomplete":"18","crosses_18_yard":"1","passes_complete_3rd_final":"5","passes_total":"42","tackles_won":"0"}},"position":"midfielder","first":"Nordi"},{"status":"starter","full":"Christopher Nkunku","last":"Nkunku","time_played_total":"90","uniform_number":"18","stats":{"touches":"70","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"1"},"stats_soccer_offensive":{"goals-left-foot":"0","crosses-18-yard-plus":"2","passes-complete-3rd-final":"13","shots-total":"2","tackles-total":"6","passes-total":"39","shots-off-goal-total":"1","passes-incomplete":"8","tackles-lost":"0","tackles-won":"6","passes-complete-long":"1","goals-total":"1","shots-on-goal-total":"1","passes-complete":"31","crosses-18-yard":"1","goals-right-foot":"0","goals-head":"0"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"4"},"stats_defensive":{"goals_against_total":"1","clearances_successful":"1"},"aerials_won":"3","stats_foul":{"fouls_commited":"1","fouls_suffered":"4"},"stats_offensive":{"tackles_lost":"0","shots_on_goal_total":"1","shots_off_goal_total":"1","tackles_total":"6","passes_complete":"31","goals_left_foot":"0","passes_incomplete":"8","goals_right_foot":"0","passes_complete_long":"1","tackles_won":"6","goals_head":"0","crosses_18_yard":"1","goals_total":"1","passes_complete_3rd_final":"13","passes_total":"39","crosses_18_yard_plus":"2","shots_total":"2"}},"position":"midfielder","first":"Christopher"},{"status":"starter","full":"Marcel Sabitzer","last":"Sabitzer","time_played_total":"89","uniform_number":"7","stats":{"touches":"67","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"1","shots-blocked-outfielder":"1"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"shots_blocked_outfielder":"1","goals_against_total":"1","clearances_successful":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"15","tackles-total":"5","passes-total":"56","shots-off-goal-total":"1","passes-incomplete":"11","tackles-lost":"1","shots-total":"2","passes-complete-long":"4","tackles-won":"4","passes-complete":"45","crosses-18-yard":"1"},"stats_foul":{"fouls_commited":"1"},"stats_offensive":{"tackles_lost":"1","shots_off_goal_total":"1","tackles_total":"5","passes_complete":"45","passes_complete_long":"4","passes_incomplete":"11","tackles_won":"4","crosses_18_yard":"1","passes_complete_3rd_final":"15","passes_total":"56","shots_total":"2"}},"position":"midfielder","first":"Marcel"},{"status":"starter","full":"Amadou Haidara","last":"Haidara","time_played_total":"76","uniform_number":"8","stats":{"touches":"64","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"1","interceptions":"4"},"stats_soccer_offensive":{"passes-complete-3rd-final":"15","tackles-total":"1","passes-total":"45","tackles-lost":"1","passes-incomplete":"8","shots-total":"2","tackles-won":"0","shots-on-goal-total":"2","passes-complete":"37"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"3"},"stats_defensive":{"goals_against_total":"1","interceptions":"4","clearances_successful":"1"},"aerials_won":"2","stats_foul":{"fouls_commited":"2","fouls_suffered":"3"},"stats_offensive":{"tackles_lost":"1","shots_on_goal_total":"2","tackles_total":"1","passes_complete":"37","passes_incomplete":"8","tackles_won":"0","passes_complete_3rd_final":"15","passes_total":"45","shots_total":"2"}},"position":"midfielder","first":"Amadou"},{"status":"starter","full":"Angeliño","last":"Esmoris Tasende","time_played_total":"90","uniform_number":"3","stats":{"touches":"72","stats_soccer_defensive":{"goals-against-total":"1","interceptions":"1"},"stats_soccer_foul":{"fouls-commited":"3","fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"1","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"14","tackles-total":"5","passes-total":"42","tackles-lost":"4","passes-incomplete":"8","shots-total":"2","assists-total":"1","tackles-won":"1","passes-complete":"34","crosses-18-yard":"1"},"stats_foul":{"fouls_commited":"3","fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"4","tackles_total":"5","passes_complete":"34","passes_incomplete":"8","tackles_won":"1","crosses_18_yard":"1","passes_complete_3rd_final":"14","passes_total":"42","assists_total":"1","shots_total":"2"}},"position":"midfielder","first":"Jose Angel"},{"status":"starter","full":"Emil Forsberg","last":"Forsberg","time_played_total":"76","uniform_number":"10","stats":{"touches":"33","stats_soccer_defensive":{"goals-against-total":"1"},"stats_soccer_offensive":{"goals-left-foot":"0","passes-complete-3rd-final":"10","passes-total":"23","shots-off-goal-total":"1","passes-incomplete":"3","shots-total":"3","goals-total":"1","shots-on-goal-total":"2","passes-complete":"20","crosses-18-yard":"1","goals-right-foot":"0","goals-head":"0"},"stats_soccer_foul":{"fouls-commited":"3","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"1"},"aerials_won":"1","stats_foul":{"fouls_commited":"3","fouls_suffered":"1"},"stats_offensive":{"goals_right_foot":"0","shots_on_goal_total":"2","shots_off_goal_total":"1","passes_complete":"20","goals_left_foot":"0","passes_incomplete":"3","goals_head":"0","crosses_18_yard":"1","goals_total":"1","passes_complete_3rd_final":"10","passes_total":"23","shots_total":"3"}},"position":"forward","first":"Emil"},{"status":"starter","full":"Dani Olmo","last":"Olmo","time_played_total":"64","uniform_number":"25","stats":{"touches":"41","stats_soccer_defensive":{"goals-against-total":"1"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"goals_against_total":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"7","tackles-total":"3","passes-total":"26","shots-off-goal-total":"1","passes-incomplete":"12","tackles-lost":"1","shots-total":"1","tackles-won":"2","passes-complete":"14"},"stats_foul":{"fouls_commited":"1"},"stats_offensive":{"tackles_lost":"1","shots_off_goal_total":"1","tackles_total":"3","passes_complete":"14","passes_incomplete":"12","tackles_won":"2","passes_complete_3rd_final":"7","passes_total":"26","shots_total":"1"}},"position":"forward","first":"Dani"},{"status":"bench","full":"Yussuf Poulsen","last":"Poulsen","time_played_total":"26","uniform_number":"9","stats":{"touches":"21","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_offensive":{"passes-complete-3rd-final":"1","tackles-total":"1","passes-total":"12","tackles-lost":"0","passes-incomplete":"3","tackles-won":"1","passes-complete":"9"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"0"},"aerials_won":"1","stats_foul":{"fouls_commited":"1","fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"9","passes_incomplete":"3","passes_complete_3rd_final":"1","passes_total":"12","tackles_won":"1"}},"position":"forward","first":"Yussuf"},{"status":"bench","full":"Hee-Chan Hwang","last":"Hwang","uniform_number":"11","position":"forward","first":"Hee-Chan"},{"status":"bench","full":"Philipp Tschauner","last":"Tschauner","uniform_number":"13","position":"goalkeeper","first":"Philipp"},{"status":"bench","full":"Tyler Adams","last":"Adams","time_played_total":"14","uniform_number":"14","stats":{"touches":"11","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"passes-complete-3rd-final":"3","tackles-total":"2","passes-total":"8","tackles-lost":"1","passes-incomplete":"1","tackles-won":"1","passes-complete":"7"},"stats_foul":{"fouls_commited":"1"},"stats_offensive":{"tackles_lost":"1","tackles_total":"2","passes_complete":"7","passes_incomplete":"1","passes_complete_3rd_final":"3","passes_total":"8","tackles_won":"1"}},"position":"midfielder","first":"Tyler"},{"status":"bench","full":"Alexander Sørloth","last":"Sørloth","uniform_number":"19","position":"forward","first":"Alexander"},{"status":"bench","full":"Lazar Samardzic","last":"Samardzic","uniform_number":"20","position":"midfielder","first":"Lazar"},{"status":"bench","full":"Justin Kluivert","last":"Kluivert","time_played_total":"14","uniform_number":"21","stats":{"touches":"8","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_offensive":{"passes-total":"5","passes-complete-3rd-final":"4","passes-complete":"4","passes-incomplete":"1"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"0"},"aerials_won":"1","stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"passes_complete":"4","passes_complete_3rd_final":"4","passes_total":"5","passes_incomplete":"1"}},"position":"forward","first":"Justin"},{"status":"bench","full":"Josep Martínez","last":"Martínez","uniform_number":"33","position":"goalkeeper","first":"Josep"},{"status":"bench","full":"Benjamin Henrichs","last":"Henrichs","time_played_total":"26","uniform_number":"39","stats":{"touches":"20","stats_soccer_defensive":{"clearances-successful":"2","goals-against-total":"0","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"2","tackles-total":"1","passes-total":"15","tackles-lost":"1","passes-incomplete":"6","passes-complete-long":"1","tackles-won":"0","passes-complete":"9"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"goals_against_total":"0","interceptions":"1","clearances_successful":"2"},"aerials_won":"2","stats_foul":{"fouls_commited":"1"},"stats_offensive":{"tackles_lost":"1","tackles_total":"1","passes_complete":"9","passes_total":"15","passes_incomplete":"6","passes_complete_3rd_final":"2","passes_complete_long":"1","tackles_won":"0"}},"position":"defender","first":"Benjamin"},{"status":"bench","full":"Kevin Kampl","last":"Kampl","time_played_total":"1","uniform_number":"44","stats":{"touches":"3","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"tackles-total":"1","passes-total":"2","tackles-lost":"0","passes-incomplete":"1","tackles-won":"1","passes-complete":"1"},"stats_foul":{},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"1","passes_incomplete":"1","passes_total":"2","tackles_won":"1"}},"position":"midfielder","first":"Kevin"},{"status":"bench","full":"Eric Martel","last":"Martel","uniform_number":"45","position":"midfielder","first":"Eric"},{"status":"bench","full":"Joscha Wosz","last":"Wosz","uniform_number":"47","position":"midfielder","first":"Joscha"}],"image":"https://st1.uvnimg.com/f5/ae/5d446b1e4d5d8829b1653406d337/leipzig-scorecells.png","stats":{"sports_property":[{"formal-name":"duels-won","value":"84"},{"formal-name":"aerials-won","value":"24"},{"formal-name":"passes-long-total","value":"61"},{"formal-name":"crosses-total","value":"13"},{"formal-name":"attempts-obox","value":"5"},{"formal-name":"attempts-ibox","value":"7"},{"formal-name":"tackles-won-percentage","value":"0.595"},{"formal-name":"passes-total","value":"494"},{"formal-name":"clearances","value":"15"},{"formal-name":"interceptions","value":"14"},{"formal-name":"passing-accuracy","value":"0.749"},{"formal-name":"crosses-accuracy","value":"0.077"},{"formal-name":"shooting-accuracy","value":"0.167"},{"formal-name":"passing-accuracy-opp-half","value":"0.693"}],"sub_score":[{"period-value":"1","score":"1"},{"period-value":"2","score":"1"}],"stats_foul":{"fouls_commited":"20","cautions_total":"2"},"team_stats_soccer":{"stats-soccer-defensive":{"shots-blocked":"3","goals-against-total":"1","interceptions":"14"},"line-formation":"352","stats-soccer-offensive":{"corner-kicks":"4","tackles-total":"37","passes-total":"494","tackles-lost":"15","shots-total":"12","tackles-won":"22","shots-on-goal-total":"5","offsides":"2"},"stats-soccer-foul":{"fouls-commited":"20","cautions-total":"2"}},"score":"2","score_opposing":"1","time_of_possession_percentage":"49.1","stats_defensive":{"goals_against_total":"1","interceptions":"14","shots_blocked":"3"},"event_outcome":"win","stats_offensive":{"tackles_lost":"15","shots_on_goal_total":"5","tackles_total":"37","corner_kicks":"4","offsides":"2","tackles_won":"22","passes_total":"494","shots_total":"12"}},"name":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"},"assitant":[]},"tournament_type":"Round","match_id":"194be0972f610d12ffa32cc98a03f86c4d6fc41d9201471fc40ce245","event_name":"RB Leipzig vs Paris Saint-Germain","season":2020,"start_time":"2020-11-04T20:00:00.000Z","eventkey":2170502,"substitutions":[{"player_position_out":"midfielder","minutes_elapsed":"64","player_position_in":"defender","period":"2","player_in":"Benjamin Henrichs","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"},"substitution_reason":"Tactical","player_out":"Nordi Mukiele"},{"player_position_out":"forward","minutes_elapsed":"64","player_position_in":"forward","period":"2","player_in":"Yussuf Poulsen","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"},"substitution_reason":"Tactical","player_out":"Dani Olmo"},{"player_position_out":"defender","minutes_elapsed":"73","player_position_in":"defender","period":"2","player_in":"Mitchel Bakker","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Tactical","player_out":"Layvin Kurzawa"},{"player_position_out":"forward","minutes_elapsed":"73","player_position_in":"defender","period":"2","player_in":"Thilo Kehrer","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Tactical","player_out":"Pablo Sarabia"},{"player_position_out":"forward","minutes_elapsed":"76","player_position_in":"forward","period":"2","player_in":"Justin Kluivert","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"},"substitution_reason":"Tactical","player_out":"Emil Forsberg"},{"player_position_out":"midfielder","minutes_elapsed":"76","player_position_in":"midfielder","period":"2","player_in":"Tyler Adams","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"},"substitution_reason":"Tactical","player_out":"Amadou Haidara"},{"player_position_out":"defender","minutes_elapsed":"84","player_position_in":"midfielder","period":"2","player_in":"Rafinha","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Tactical","player_out":"Alessandro Florenzi"},{"player_position_out":"midfielder","minutes_elapsed":"90","player_position_in":"midfielder","period":"2","player_in":"Kevin Kampl","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"},"substitution_reason":"Tactical","player_out":"Marcel Sabitzer"}],"stadium":"Red Bull Arena","officials":[{"lastname":"Marciniak","full":"Szymon Marciniak","role":"main-official","first":"Szymon"}],"result":[2,1],"event_outcome_type":"regular","scores":[{"minutes_elapsed":"6","participants":[{"player":{"abbreviation":"Di María","position":"forward","full":"Ángel Di María","last":"Di María","first":"Ángel"},"role":"scorer"},{"player":{"abbreviation":"Kean","position":"forward","full":"Moise Kean","last":"Kean","first":"Moise"},"role":"assist"}],"score_type":"regular","period":"1","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"minutes_elapsed":"41","participants":[{"player":{"abbreviation":"Nkunku","position":"midfielder","full":"Christopher Nkunku","last":"Nkunku","first":"Christopher"},"role":"scorer"},{"player":{"abbreviation":"Esmoris Tasende","position":"midfielder","full":"Angeliño","last":"Esmoris Tasende","first":"Jose Angel"},"role":"assist"}],"score_type":"regular","period":"1","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"}},{"minutes_elapsed":"57","participants":[{"player":{"abbreviation":"Forsberg","position":"forward","full":"Emil Forsberg","last":"Forsberg","first":"Emil"},"role":"scorer"}],"score_type":"penalty","period":"2","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"}}],"date":"2020-11-04","penalties":[{"comment":"Handball","penalty_type":"handball","penalty_level":"yellow-card","minutes_elapsed":"15","period":"1","player":{"abbreviation":"Upamecano","position":"defender","full":"Dayot Upamecano","last":"Upamecano","first":"Dayot"},"recipient_type":"player","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-card","minutes_elapsed":"19","period":"1","player":{"abbreviation":"Kimpembe","position":"defender","full":"Presnel Kimpembe","last":"Kimpembe","first":"Presnel"},"recipient_type":"player","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-card","minutes_elapsed":"25","period":"1","player":{"abbreviation":"Konaté","position":"defender","full":"Ibrahima Konaté","last":"Konaté","first":"Ibrahima"},"recipient_type":"player","team":{"abbrev":"RBL","full":"RB Leipzig","first":"RB Leipzig"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-card","minutes_elapsed":"37","period":"1","player":{"abbreviation":"Gueye","position":"midfielder","full":"Idrissa Gueye","last":"Gueye","first":"Idrissa"},"recipient_type":"player","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-card","minutes_elapsed":"67","period":"2","player":{"abbreviation":"Kurzawa","position":"defender","full":"Layvin Kurzawa","last":"Kurzawa","first":"Layvin"},"recipient_type":"player","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-red-card","minutes_elapsed":"69","period":"2","player":{"abbreviation":"Gueye","position":"midfielder","full":"Idrissa Gueye","last":"Gueye","first":"Idrissa"},"recipient_type":"player","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-red-card","minutes_elapsed":"95","period":"2","player":{"abbreviation":"Kimpembe","position":"defender","full":"Presnel Kimpembe","last":"Kimpembe","first":"Presnel"},"recipient_type":"player","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}}],"extra_time":"6","tournament_name":"Champions League","visitant_team":{"players":[{"status":"starter","full":"Keylor Navas","last":"Navas","time_played_total":"90","uniform_number":"1","stats":{"touches":"56","stats_soccer_defensive":{"goals-against-total":"2","saves":"3","goals-penalty-shot-allowed":"1","catches-punches":"1","save-percentage":"0.429"},"stats_soccer_foul":{},"stats_defensive":{"saves":"3","goals_against_total":"2","catches_punches":"1","goals_penalty_shot_allowed":"1","save_percentage":"0.429"},"stats_soccer_offensive":{"passes-total":"45","passes-complete-long":"3","passes-complete":"25","passes-incomplete":"20"},"stats_foul":{},"stats_offensive":{"passes_complete":"25","passes_complete_long":"3","passes_incomplete":"20","passes_total":"45"}},"position":"goalkeeper","first":"Keylor"},{"status":"starter","full":"Alessandro Florenzi","last":"Florenzi","time_played_total":"84","uniform_number":"24","stats":{"touches":"61","stats_soccer_defensive":{"shots-blocked-outfielder":"1","goals-against-total":"2","interceptions":"2"},"stats_soccer_offensive":{"passes-complete-3rd-final":"7","tackles-total":"2","passes-total":"43","tackles-lost":"1","passes-incomplete":"8","shots-total":"1","passes-complete-long":"4","tackles-won":"1","passes-complete":"35"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"2","shots_blocked_outfielder":"1","interceptions":"2"},"aerials_won":"3","stats_foul":{},"stats_offensive":{"tackles_lost":"1","tackles_total":"2","passes_complete":"35","passes_complete_long":"4","passes_incomplete":"8","tackles_won":"1","passes_complete_3rd_final":"7","passes_total":"43","shots_total":"1"}},"position":"defender","first":"Alessandro"},{"status":"starter","full":"Danilo Pereira","last":"Hélio Pereira","time_played_total":"90","uniform_number":"15","stats":{"touches":"73","stats_soccer_defensive":{"clearances-successful":"3","goals-against-total":"2","interceptions":"1"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"2","tackles-total":"1","passes-total":"63","tackles-lost":"0","passes-incomplete":"8","passes-complete-long":"3","tackles-won":"1","passes-complete":"55"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"2","interceptions":"1","clearances_successful":"3"},"aerials_won":"2","stats_foul":{"fouls_commited":"1","fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"55","passes_complete_long":"3","passes_incomplete":"8","passes_complete_3rd_final":"2","passes_total":"63","crosses_18_yard_plus":"1","tackles_won":"1"}},"position":"defender","first":"Danilo Luís"},{"status":"starter","full":"Presnel Kimpembe","last":"Kimpembe","time_played_total":"89","uniform_number":"3","stats":{"touches":"72","stats_soccer_defensive":{"clearances-successful":"3","goals-against-total":"2","shots-penalty-shot-allowed":"1","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"1","tackles-total":"2","passes-total":"62","tackles-lost":"0","passes-incomplete":"7","passes-complete-long":"5","tackles-won":"2","passes-complete":"55"},"stats_soccer_foul":{"fouls-commited":"5","fouls-suffered":"2"},"stats_defensive":{"shots_penalty_shot_allowed":"1","goals_against_total":"2","interceptions":"1","clearances_successful":"3"},"aerials_won":"1","stats_foul":{"fouls_commited":"5","fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"0","tackles_total":"2","passes_complete":"55","passes_total":"62","passes_incomplete":"7","passes_complete_3rd_final":"1","passes_complete_long":"5","tackles_won":"2"}},"position":"defender","first":"Presnel"},{"status":"starter","full":"Layvin Kurzawa","last":"Kurzawa","time_played_total":"73","uniform_number":"20","stats":{"touches":"71","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"2","interceptions":"3"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"2","tackles-total":"3","passes-total":"44","tackles-lost":"1","passes-incomplete":"12","passes-complete-long":"2","tackles-won":"2","passes-complete":"32"},"stats_soccer_foul":{"fouls-commited":"2","cautions-total":"1"},"stats_defensive":{"goals_against_total":"2","interceptions":"3","clearances_successful":"1"},"aerials_won":"2","stats_foul":{"fouls_commited":"2","cautions_total":"1"},"stats_offensive":{"tackles_lost":"1","tackles_total":"3","passes_complete":"32","passes_complete_long":"2","passes_incomplete":"12","passes_complete_3rd_final":"2","passes_total":"44","crosses_18_yard_plus":"1","tackles_won":"2"}},"position":"defender","first":"Layvin"},{"status":"starter","full":"Idrissa Gueye","last":"Gueye","time_played_total":"69","uniform_number":"27","stats":{"touches":"51","stats_soccer_defensive":{"goals-against-total":"2","interceptions":"3"},"stats_soccer_foul":{"fouls-commited":"3","fouls-suffered":"5"},"stats_defensive":{"goals_against_total":"2","interceptions":"3"},"stats_soccer_offensive":{"passes-complete-3rd-final":"2","tackles-total":"1","passes-total":"31","tackles-lost":"0","passes-incomplete":"7","tackles-won":"1","passes-complete":"24"},"stats_foul":{"fouls_commited":"3","fouls_suffered":"5"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"24","passes_incomplete":"7","passes_complete_3rd_final":"2","passes_total":"31","tackles_won":"1"}},"position":"midfielder","first":"Idrissa"},{"status":"starter","full":"Marquinhos","last":"Aoas Correa","time_played_total":"90","uniform_number":"5","stats":{"touches":"84","stats_soccer_defensive":{"clearances-successful":"2","goals-against-total":"2","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"8","tackles-total":"2","passes-total":"65","tackles-lost":"1","passes-incomplete":"11","tackles-won":"1","passes-complete":"54"},"stats_soccer_foul":{"fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"2","interceptions":"1","clearances_successful":"2"},"aerials_won":"4","stats_foul":{"fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"1","tackles_total":"2","passes_complete":"54","passes_incomplete":"11","passes_complete_3rd_final":"8","passes_total":"65","tackles_won":"1"}},"position":"midfielder","first":"Marcos"},{"status":"starter","full":"Ander Herrera","last":"Herrera","time_played_total":"90","uniform_number":"21","stats":{"touches":"85","stats_soccer_defensive":{"clearances-successful":"2","goals-against-total":"2","interceptions":"2","shots-blocked-outfielder":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"4","tackles-total":"4","passes-total":"51","tackles-lost":"0","passes-incomplete":"8","shots-total":"1","passes-complete-long":"2","tackles-won":"4","passes-complete":"43"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"4"},"stats_defensive":{"shots_blocked_outfielder":"1","goals_against_total":"2","interceptions":"2","clearances_successful":"2"},"aerials_won":"1","stats_foul":{"fouls_commited":"2","fouls_suffered":"4"},"stats_offensive":{"tackles_lost":"0","tackles_total":"4","passes_complete":"43","passes_complete_long":"2","passes_incomplete":"8","tackles_won":"4","passes_complete_3rd_final":"4","passes_total":"51","shots_total":"1"}},"position":"midfielder","first":"Ander"},{"status":"starter","full":"Ángel Di María","last":"Di María","time_played_total":"90","uniform_number":"11","stats":{"touches":"73","stats_soccer_defensive":{"goals-against-total":"2"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"2"},"stats_soccer_offensive":{"goals-left-foot":"0","crosses-18-yard-plus":"3","passes-complete-3rd-final":"6","passes-total":"33","passes-incomplete":"7","shots-total":"3","passes-complete-long":"3","goals-total":"1","shots-on-goal-total":"2","passes-complete":"26","crosses-18-yard":"2","goals-right-foot":"0","goals-head":"0"},"stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"goals_right_foot":"0","shots_on_goal_total":"2","passes_complete":"26","goals_left_foot":"0","passes_incomplete":"7","passes_complete_long":"3","goals_head":"0","crosses_18_yard":"2","goals_total":"1","passes_complete_3rd_final":"6","passes_total":"33","crosses_18_yard_plus":"3","shots_total":"3"}},"position":"forward","first":"Ángel"},{"status":"starter","full":"Moise Kean","last":"Kean","time_played_total":"90","uniform_number":"18","stats":{"touches":"40","stats_soccer_defensive":{"goals-against-total":"2","interceptions":"1"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"2","interceptions":"1"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"3","assists-total":"1","passes-total":"9","shots-off-goal-total":"1","passes-incomplete":"2","shots-total":"3","passes-complete":"7","crosses-18-yard":"1"},"stats_foul":{"fouls_commited":"2","fouls_suffered":"1"},"stats_offensive":{"shots_off_goal_total":"1","passes_complete":"7","passes_incomplete":"2","crosses_18_yard":"1","crosses_18_yard_plus":"1","passes_complete_3rd_final":"3","passes_total":"9","assists_total":"1","shots_total":"3"}},"position":"forward","first":"Moise"},{"status":"starter","full":"Pablo Sarabia","last":"Sarabia","time_played_total":"73","uniform_number":"19","stats":{"touches":"36","stats_soccer_defensive":{"goals-against-total":"2"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"2"},"stats_soccer_offensive":{"crosses-18-yard-plus":"2","passes-complete-3rd-final":"8","tackles-total":"3","passes-total":"24","tackles-lost":"0","passes-incomplete":"4","passes-complete-long":"1","tackles-won":"3","passes-complete":"20"},"stats_foul":{"fouls_commited":"2","fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"0","tackles_total":"3","passes_complete":"20","passes_complete_long":"1","passes_incomplete":"4","passes_complete_3rd_final":"8","passes_total":"24","crosses_18_yard_plus":"2","tackles_won":"3"}},"position":"forward","first":"Pablo"},{"status":"bench","full":"Thilo Kehrer","last":"Kehrer","time_played_total":"17","uniform_number":"4","stats":{"touches":"12","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"0","shots-blocked-outfielder":"1"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"1"},"stats_defensive":{"shots_blocked_outfielder":"1","goals_against_total":"0","clearances_successful":"1"},"stats_soccer_offensive":{"passes-total":"8","passes-complete-3rd-final":"2","passes-complete":"7","passes-incomplete":"1"},"stats_foul":{"fouls_commited":"2","fouls_suffered":"1"},"stats_offensive":{"passes_complete":"7","passes_complete_3rd_final":"2","passes_total":"8","passes_incomplete":"1"}},"position":"defender","first":"Thilo"},{"status":"bench","full":"Leandro Paredes","last":"Paredes","uniform_number":"8","position":"midfielder","first":"Leandro"},{"status":"bench","full":"Rafinha","last":"Alcántara do Nascimento","time_played_total":"6","uniform_number":"12","stats":{"touches":"13","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"crosses-18-yard-plus":"2","passes-total":"8","passes-complete":"6","passes-incomplete":"2"},"stats_foul":{},"stats_offensive":{"passes_complete":"6","passes_incomplete":"2","passes_total":"8","crosses_18_yard_plus":"2"}},"position":"midfielder","first":"Rafael"},{"status":"bench","full":"Sergio Rico","last":"Rico","uniform_number":"16","position":"goalkeeper","first":"Sergio"},{"status":"bench","full":"Abdou Diallo","last":"Diallo","uniform_number":"22","position":"defender","first":"Abdou"},{"status":"bench","full":"Mitchel Bakker","last":"Bakker","time_played_total":"17","uniform_number":"25","stats":{"touches":"21","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_offensive":{"passes-total":"14","passes-complete-long":"1","passes-complete":"10","passes-incomplete":"4"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"goals_against_total":"0"},"aerials_won":"1","stats_foul":{"fouls_commited":"1"},"stats_offensive":{"passes_complete":"10","passes_complete_long":"1","passes_incomplete":"4","passes_total":"14"}},"position":"defender","first":"Mitchel"},{"status":"bench","full":"Colin Dagba","last":"Dagba","uniform_number":"31","position":"defender","first":"Colin"},{"status":"bench","full":"Timothee Pembele","last":"Pembele","uniform_number":"32","position":"defender","first":"Timothee"},{"status":"bench","full":"Kays Ruiz-Atil","last":"Ruiz-Atil","uniform_number":"36","position":"midfielder","first":"Kays"},{"status":"bench","full":"Bandiougou Fadiga","last":"Fadiga","uniform_number":"37","position":"midfielder","first":"Bandiougou"},{"status":"bench","full":"Mathyas Randriamamy","last":"Randriamamy","uniform_number":"60","position":"goalkeeper","first":"Mathyas"}],"image":"https://st1.uvnimg.com/42/17/b9ec80ea49418f0163800d3c0412/paris2-2x.png","stats":{"sports_property":[{"formal-name":"duels-won","value":"64"},{"formal-name":"aerials-won","value":"14"},{"formal-name":"passes-long-total","value":"67"},{"formal-name":"crosses-total","value":"18"},{"formal-name":"attempts-obox","value":"1"},{"formal-name":"attempts-ibox","value":"7"},{"formal-name":"tackles-won-percentage","value":"0.833"},{"formal-name":"passes-total","value":"500"},{"formal-name":"clearances","value":"12"},{"formal-name":"interceptions","value":"14"},{"formal-name":"passing-accuracy","value":"0.798"},{"formal-name":"crosses-accuracy","value":"0.111"},{"formal-name":"shooting-accuracy","value":"0.125"},{"formal-name":"passing-accuracy-opp-half","value":"0.659"}],"sub_score":[{"period-value":"1","score":"1"},{"period-value":"2","score":"0"}],"stats_foul":{"fouls_commited":"20","cautions_total":"1"},"team_stats_soccer":{"stats-soccer-defensive":{"shots-blocked":"5","goals-against-total":"2","interceptions":"14"},"line-formation":"433","stats-soccer-offensive":{"corner-kicks":"3","tackles-total":"18","passes-total":"500","tackles-lost":"3","shots-total":"8","tackles-won":"15","shots-on-goal-total":"2","offsides":"7"},"stats-soccer-foul":{"fouls-commited":"20","cautions-total":"1"}},"score":"1","score_opposing":"2","time_of_possession_percentage":"50.9","stats_defensive":{"goals_against_total":"2","interceptions":"14","shots_blocked":"5"},"event_outcome":"loss","stats_offensive":{"tackles_lost":"3","shots_on_goal_total":"2","tackles_total":"18","corner_kicks":"3","offsides":"7","tackles_won":"15","passes_total":"500","shots_total":"8"}},"name":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"assitant":[]}}]


Le problème c'est que je n'arrive pas à l'afficher évidemment
J'ai essayé 3 codes

 $buteurs = $resultats->scores;        
                        foreach($buteurs as $buteur)
                        {
                          if(
                            property_exists($buteur,'player')
                          &&property_exists($buteur->player,'full')
                          &&property_exists($buteur,'team')
                          &&property_exists($buteur->team,'full')
                          &&property_exists($buteur,'minutes_elapsed')
                          )
                          echo "<img src='../images/ballon.png'>&nbsp;" . $buteur->player->full . " (" . $buteur->minutes_elapsed . "e - " . $buteur->team->full . ")<br />";
                        }

La je n ai aucun message d'erreur (je n'ai juste pas d'affichage des buteurs)
Comme 2e code

 $buteurs = $resultats->scores;
                        foreach($buteurs as $buteur)
                        {
                          if(
                                property_exists($buteur->participants,'player')
                          &&property_exists($buteur->participants->player,'full')
                          &&property_exists($buteur,'team')
                          &&property_exists($buteur->team,'full')
                          &&property_exists($buteur,'minutes_elapsed')
                          )
                          echo "<img src='../images/ballon.png'>&nbsp;" . $buteur->participants->player->full . " (" . $buteur->minutes_elapsed . "e - " . $buteur->team->full . ")<br />";
                        }
                        }


J'ai comme message d'erreur
Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\mes_sites\api\php\stats.php on line 180

Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\mes_sites\api\php\stats.php on line 180

Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\mes_sites\api\php\stats.php on line 180


et comme 3e code (que j'ai utilisé par désespoir)

 $buteurs = $resultats->scores;
                        foreach($buteurs as $buteur)
                        {
                          if(property_exists($buteur->participants)
                          &&property_exists($buteur->participants,'player')
                          &&property_exists($buteur->participants->player,'full')
                          &&property_exists($buteur,'team')
                          &&property_exists($buteur->team,'full')
                          &&property_exists($buteur,'minutes_elapsed')
                          )
                          echo "<img src='../images/ballon.png'>&nbsp;" . $buteur->participants->player->full . " (" . $buteur->minutes_elapsed . "e - " . $buteur->team->full . ")<br />";
                        }
                        }


J'ai comme message d'erreur

Warning: property_exists() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\mes_sites\api\php\stats.php on line 180

Warning: property_exists() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\mes_sites\api\php\stats.php on line 180

Warning: property_exists() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\mes_sites\api\php\stats.php on line 180


Merci pour l'aide Smiley confused
Modérateur
Bonjour,

$buteur n'a pas de propriété "player". Il a une propriété "participants" qui est un tableau dont chaque élément a pour propriété "player". Il faut donc faire un foreach supplémentaire sur la propriété "participants" (et il faut aussi vérifier le role du "player" qui doit être "scorer" si toutefois j'ai compris quelque chose au foot).

Si l'on suppose que $resultats contient bien le résultat d'un seul match, et qu'il a bien une propriété "scores", alors, avec un peu de chance, le code ci-dessous pourrait fonctionner :

$buteurs = $resultats->scores; 
foreach($buteurs as $buteur)
{
	if(
		property_exists($buteur,'participants')
		&&property_exists($buteur,'team')
		&&property_exists($buteur->team,'full')
		&&property_exists($buteur,'minutes_elapsed')
	)
	{
		foreach($buteur->participants as $participant)
		{
			if(property_exists($participant,'player')
				&&property_exists($participant->player,'full')
				&&property_exists($participant,'role')
				&&($participant->role=="scorer"))
			echo "<img src='../images/ballon.png'>&nbsp;" . $participant->player->full . " (" . $buteur->minutes_elapsed . "e - " . $buteur->team->full . ")<br />";
		}
	}
}

Amicalement,
Modifié par parsimonhi (10 Nov 2020 - 18:52)
Merci ça fonctionne nickel. Je n'ai même pas pensé au foreach dans un foreach. Mon problème est que je n'arrive pas a déchiffrer l'arborescence je pense.
Pages :