8768 sujets
Développement web côté serveur, CMS
Bonjour,
j'ai essayé avec le stats en plus et j'ai toujours les même message qu'initialement.
Ce que je trouve bizarre c'est le changement de coloration syntaxique de mon éditeur quand je mets le tiret.
Je vous joins le screenshot de ma vue editeur.
Cordialement
ps : je n'ai pas oublié l'accolade de fermeture. C'est juste qu'il y a d'autres variables définies sous celle-ci et l'accolade de fermeture est bien présente (même si on ne la voit pas sur le screenshot)
Modifié par michel4-7 (30 Oct 2020 - 08:50)
j'ai essayé avec le stats en plus et j'ai toujours les même message qu'initialement.
Ce que je trouve bizarre c'est le changement de coloration syntaxique de mon éditeur quand je mets le tiret.
Je vous joins le screenshot de ma vue editeur.
Cordialement
ps : je n'ai pas oublié l'accolade de fermeture. C'est juste qu'il y a d'autres variables définies sous celle-ci et l'accolade de fermeture est bien présente (même si on ne la voit pas sur le screenshot)
Modifié par michel4-7 (30 Oct 2020 - 08:50)
Oui je pensais bien que cela venait du tiret...
Par contre cela ne fonctionne toujours pas (il ne me reste plus que 3 messages d'erreurs au lieu de 4 initialement)
Notice: Undefined property: stdClass::$stats
Notice: Trying to get property 'stats_soccer_offensive' of non-object
Notice: Trying to get property 'goals-total' of non-object
Par contre cela ne fonctionne toujours pas (il ne me reste plus que 3 messages d'erreurs au lieu de 4 initialement)
Notice: Undefined property: stdClass::$stats
Notice: Trying to get property 'stats_soccer_offensive' of non-object
Notice: Trying to get property 'goals-total' of non-object
Bonjour,
Il faudrait que tu postes l'enregistrement complet pour le match.
Quand tu rédiges ton post, tu cliques sur "code" sur la ligne "coloration syntaxique" qui est sous l'encart où on rédige le post, et tu colles le texte (et non une image) de l'enregistrement du match.
Ce sera plus facile pour faire le diagnostic.
Amicalement,
Modifié par parsimonhi (30 Oct 2020 - 10:01)
Il faudrait que tu postes l'enregistrement complet pour le match.
Quand tu rédiges ton post, tu cliques sur "code" sur la ligne "coloration syntaxique" qui est sous l'encart où on rédige le post, et tu colles le texte (et non une image) de l'enregistrement du match.
Ce sera plus facile pour faire le diagnostic.
Amicalement,
Modifié par parsimonhi (30 Oct 2020 - 10:01)
J'essaye, je ne sais pas si ce sera bon ...
En fait je viens de me rendre compte qu'il y avait 2 goals total (un avec tiret et un avec un underscore), j'ai du me tromper d'argument ...
Modifié par michel4-7 (30 Oct 2020 - 10:03)
{"status":"bench","full":"Kylian Mbappé","last":"Mbappé","time_played_total":"17","uniform_number":"7","stats":{"touches":"13","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"goals-left-foot":"0","passes-complete-3rd-final":"4","passes-total":"10","passes-incomplete":"0","shots-total":"2","goals-total":"2","shots-on-goal-total":"2","passes-complete":"10","goals-right-foot":"0","goals-head":"0"},"stats_foul":{},"stats_offensive":{"goals_right_foot":"0","shots_on_goal_total":"2","passes_complete":"10","goals_left_foot":"0","passes_incomplete":"0","shots_total":"2","goals_head":"0","passes_complete_3rd_final":"4","passes_total":"10","goals_total":"2"}},"position":"forward","first":"Kylian"},
En fait je viens de me rendre compte qu'il y avait 2 goals total (un avec tiret et un avec un underscore), j'ai du me tromper d'argument ...
Modifié par michel4-7 (30 Oct 2020 - 10:03)
Moi je peux mettre l'intégralité des données mais ça va être imbuvable (ça va reprendre toutes les statistiques de tous les joueurs du match). Attention j'y vais
[{"city":"Paris","home_team":{"players":[{"status":"starter","full":"Sergio Rico","last":"Rico","time_played_total":"90","uniform_number":"16","stats":{"touches":"22","stats_soccer_defensive":{"catches-punches":"2","saves":"3","goals-against-total":"0","save-percentage":"0"},"stats_soccer_foul":{},"stats_defensive":{"saves":"3","catches_punches":"2","goals_against_total":"0","save_percentage":"0"},"stats_soccer_offensive":{"passes-total":"14","passes-complete-long":"2","passes-complete":"14","passes-incomplete":"0"},"stats_foul":{},"stats_offensive":{"passes_complete":"14","passes_complete_long":"2","passes_incomplete":"0","passes_total":"14"}},"position":"goalkeeper","first":"Sergio"},{"status":"starter","full":"Colin Dagba","last":"Dagba","time_played_total":"90","uniform_number":"31","stats":{"touches":"62","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"0","interceptions":"4"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"0","interceptions":"4","clearances_successful":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"9","tackles-total":"7","passes-total":"40","shots-off-goal-total":"1","passes-incomplete":"3","tackles-lost":"3","shots-total":"1","tackles-won":"4","passes-complete":"37"},"stats_foul":{"fouls_commited":"2","fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"3","shots_off_goal_total":"1","tackles_total":"7","passes_complete":"37","passes_incomplete":"3","tackles_won":"4","passes_complete_3rd_final":"9","passes_total":"40","shots_total":"1"}},"position":"defender","first":"Colin"},{"status":"starter","full":"Danilo Pereira","last":"Hélio Pereira","time_played_total":"90","uniform_number":"15","stats":{"touches":"92","stats_soccer_defensive":{"clearances-successful":"5","goals-against-total":"0","interceptions":"2","shots-blocked-outfielder":"2"},"stats_soccer_offensive":{"passes-complete-3rd-final":"3","tackles-total":"1","passes-total":"79","shots-off-goal-total":"1","passes-incomplete":"4","tackles-lost":"0","shots-total":"2","passes-complete-long":"3","tackles-won":"1","shots-on-goal-total":"1","passes-complete":"75"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"1"},"stats_defensive":{"shots_blocked_outfielder":"2","goals_against_total":"0","interceptions":"2","clearances_successful":"5"},"aerials_won":"1","stats_foul":{"fouls_commited":"1","fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"0","shots_on_goal_total":"1","shots_off_goal_total":"1","tackles_total":"1","passes_complete":"75","passes_complete_long":"3","passes_incomplete":"4","tackles_won":"1","passes_complete_3rd_final":"3","passes_total":"79","shots_total":"2"}},"position":"defender","first":"Danilo Luís"},{"status":"starter","full":"Abdou Diallo","last":"Diallo","time_played_total":"90","uniform_number":"22","stats":{"touches":"77","stats_soccer_defensive":{"shots-blocked-cross":"1","clearances-successful":"5","goals-against-total":"0","shots-blocked-outfielder":"2"},"stats_soccer_offensive":{"passes-complete-3rd-final":"3","tackles-total":"1","passes-total":"64","tackles-lost":"0","passes-incomplete":"0","passes-complete-long":"7","tackles-won":"1","passes-complete":"64"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"1"},"stats_defensive":{"shots_blocked_cross":"1","shots_blocked_outfielder":"2","goals_against_total":"0","clearances_successful":"5"},"aerials_won":"1","stats_foul":{"fouls_commited":"1","fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"64","passes_total":"64","passes_incomplete":"0","passes_complete_3rd_final":"3","passes_complete_long":"7","tackles_won":"1"}},"position":"defender","first":"Abdou"},{"status":"starter","full":"Mitchel Bakker","last":"Bakker","time_played_total":"90","uniform_number":"25","stats":{"touches":"65","stats_soccer_defensive":{"shots-blocked-cross":"1","clearances-successful":"2","goals-against-total":"0"},"stats_soccer_offensive":{"passes-complete-3rd-final":"5","tackles-total":"4","passes-total":"48","tackles-lost":"0","passes-incomplete":"3","assists-total":"1","passes-complete-long":"1","tackles-won":"4","passes-complete":"45","crosses-18-yard":"3"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"shots_blocked_cross":"1","goals_against_total":"0","clearances_successful":"2"},"aerials_won":"2","stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"4","passes_complete":"45","passes_complete_long":"1","passes_incomplete":"3","crosses_18_yard":"3","passes_complete_3rd_final":"5","passes_total":"48","assists_total":"1","tackles_won":"4"}},"position":"defender","first":"Mitchel"},{"status":"starter","full":"Julian Draxler","last":"Draxler","time_played_total":"59","uniform_number":"23","stats":{"touches":"62","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"passes-complete-3rd-final":"12","tackles-total":"1","passes-total":"58","tackles-lost":"0","passes-incomplete":"4","shots-total":"1","passes-complete-long":"5","tackles-won":"1","passes-complete":"54"},"stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"54","passes_complete_long":"5","passes_incomplete":"4","tackles_won":"1","passes_complete_3rd_final":"12","passes_total":"58","shots_total":"1"}},"position":"midfielder","first":"Julian"},{"status":"starter","full":"Marquinhos","last":"Aoas Correa","time_played_total":"73","uniform_number":"5","stats":{"touches":"59","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"0","shots-blocked-outfielder":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"11","tackles-total":"2","passes-total":"53","tackles-lost":"0","passes-incomplete":"6","passes-complete-long":"2","tackles-won":"2","passes-complete":"47"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"shots_blocked_outfielder":"1","goals_against_total":"0","clearances_successful":"1"},"aerials_won":"1","stats_foul":{"fouls_commited":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"2","passes_complete":"47","passes_total":"53","passes_incomplete":"6","passes_complete_3rd_final":"11","passes_complete_long":"2","tackles_won":"2"}},"position":"midfielder","first":"Marcos"},{"status":"starter","full":"Rafinha","last":"Alcántara do Nascimento","time_played_total":"85","uniform_number":"12","stats":{"touches":"58","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_offensive":{"passes-complete-3rd-final":"11","tackles-total":"2","passes-total":"42","tackles-lost":"1","passes-incomplete":"8","tackles-won":"1","passes-complete":"34","crosses-18-yard":"1"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"3"},"stats_defensive":{"goals_against_total":"0"},"aerials_won":"1","stats_foul":{"fouls_commited":"2","fouls_suffered":"3"},"stats_offensive":{"tackles_lost":"1","tackles_total":"2","passes_complete":"34","passes_incomplete":"8","crosses_18_yard":"1","passes_complete_3rd_final":"11","passes_total":"42","tackles_won":"1"}},"position":"midfielder","first":"Rafael"},{"status":"starter","full":"Pablo Sarabia","last":"Sarabia","time_played_total":"90","uniform_number":"19","stats":{"touches":"42","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"0","interceptions":"1"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"0","interceptions":"1","clearances_successful":"1"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"12","passes-total":"28","assists-total":"1","passes-incomplete":"4","shots-total":"3","shots-on-goal-total":"2","passes-complete":"24","crosses-18-yard":"3"},"stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"shots_on_goal_total":"2","passes_complete":"24","passes_incomplete":"4","crosses_18_yard":"3","crosses_18_yard_plus":"1","passes_complete_3rd_final":"12","passes_total":"28","assists_total":"1","shots_total":"3"}},"position":"forward","first":"Pablo"},{"status":"starter","full":"Moise Kean","last":"Kean","time_played_total":"73","uniform_number":"18","stats":{"touches":"14","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_offensive":{"goals-left-foot":"0","passes-complete-3rd-final":"3","shots-total":"4","tackles-total":"1","passes-total":"7","shots-off-goal-total":"2","passes-incomplete":"1","tackles-lost":"0","tackles-won":"1","goals-total":"2","shots-on-goal-total":"2","passes-complete":"6","goals-right-foot":"0","goals-head":"0"},"stats_soccer_foul":{"fouls-commited":"2"},"stats_defensive":{"goals_against_total":"0"},"aerials_won":"1","stats_foul":{"fouls_commited":"2"},"stats_offensive":{"tackles_lost":"0","shots_on_goal_total":"2","shots_off_goal_total":"2","tackles_total":"1","passes_complete":"6","goals_left_foot":"0","passes_incomplete":"1","goals_right_foot":"0","tackles_won":"1","goals_head":"0","goals_total":"2","passes_complete_3rd_final":"3","passes_total":"7","shots_total":"4"}},"position":"forward","first":"Moise"},{"status":"starter","full":"Neymar","last":"Santos Júnior","time_played_total":"90","uniform_number":"10","stats":{"touches":"95","stats_soccer_defensive":{"goals-against-total":"0","interceptions":"3"},"stats_soccer_offensive":{"passes-complete-3rd-final":"13","tackles-total":"2","passes-total":"45","shots-off-goal-total":"4","passes-incomplete":"10","tackles-lost":"1","shots-total":"7","assists-total":"2","tackles-won":"1","shots-on-goal-total":"2","passes-complete":"35","crosses-18-yard":"1","free-kicks":"3"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"8"},"stats_defensive":{"goals_against_total":"0","interceptions":"3"},"aerials_won":"1","stats_foul":{"fouls_commited":"1","fouls_suffered":"8"},"stats_offensive":{"tackles_lost":"1","shots_on_goal_total":"2","shots_off_goal_total":"4","tackles_total":"2","passes_complete":"35","passes_incomplete":"10","tackles_won":"1","free_kicks":"3","crosses_18_yard":"1","passes_complete_3rd_final":"13","passes_total":"45","assists_total":"2","shots_total":"7"}},"position":"forward","first":"Neymar da Silva"},{"status":"bench","full":"Keylor Navas","last":"Navas","uniform_number":"1","position":"goalkeeper","first":"Keylor"},{"status":"bench","full":"Presnel Kimpembe","last":"Kimpembe","uniform_number":"3","position":"defender","first":"Presnel"},{"status":"bench","full":"Kylian Mbappé","last":"Mbappé","time_played_total":"17","uniform_number":"7","stats":{"touches":"13","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"goals-left-foot":"0","passes-complete-3rd-final":"4","passes-total":"10","passes-incomplete":"0","shots-total":"2","goals-total":"2","shots-on-goal-total":"2","passes-complete":"10","goals-right-foot":"0","goals-head":"0"},"stats_foul":{},"stats_offensive":{"goals_right_foot":"0","shots_on_goal_total":"2","passes_complete":"10","goals_left_foot":"0","passes_incomplete":"0","shots_total":"2","goals_head":"0","passes_complete_3rd_final":"4","passes_total":"10","goals_total":"2"}},"position":"forward","first":"Kylian"},{"status":"bench","full":"Ander Herrera","last":"Herrera","time_played_total":"31","uniform_number":"21","stats":{"touches":"37","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"0","interceptions":"1"},"stats_soccer_foul":{"fouls-commited":"1"},"stats_defensive":{"goals_against_total":"0","interceptions":"1","clearances_successful":"1"},"stats_soccer_offensive":{"passes-total":"34","passes-complete-3rd-final":"4","passes-complete":"30","passes-incomplete":"4"},"stats_foul":{"fouls_commited":"1"},"stats_offensive":{"passes_complete":"30","passes_complete_3rd_final":"4","passes_total":"34","passes_incomplete":"4"}},"position":"midfielder","first":"Ander"},{"status":"bench","full":"Alessandro Florenzi","last":"Florenzi","uniform_number":"24","position":"defender","first":"Alessandro"},{"status":"bench","full":"Timothee Pembele","last":"Pembele","uniform_number":"32","position":"defender","first":"Timothee"},{"status":"bench","full":"Maxen Kapo","last":"Kapo","uniform_number":"33","position":"midfielder","first":"Maxen"},{"status":"bench","full":"Kays Ruiz-Atil","last":"Ruiz-Atil","time_played_total":"17","uniform_number":"36","stats":{"touches":"15","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"0","interceptions":"1"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"0","interceptions":"1","clearances_successful":"1"},"stats_soccer_offensive":{"passes-total":"12","passes-complete-3rd-final":"1","passes-complete":"11","passes-incomplete":"1"},"stats_foul":{"fouls_commited":"1","fouls_suffered":"1"},"stats_offensive":{"passes_complete":"11","passes_complete_3rd_final":"1","passes_total":"12","passes_incomplete":"1"}},"position":"midfielder","first":"Kays"},{"status":"bench","full":"Bandiougou Fadiga","last":"Fadiga","time_played_total":"5","uniform_number":"37","stats":{"touches":"3","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"passes-total":"3","passes-complete":"2","passes-incomplete":"1"},"stats_foul":{},"stats_offensive":{"passes_complete":"2","passes_incomplete":"1","passes_total":"3"}},"position":"midfielder","first":"Bandiougou"}],"image":"https://st1.uvnimg.com/42/17/b9ec80ea49418f0163800d3c0412/paris2-2x.png","stats":{"sports_property":[{"formal-name":"duels-won","value":"55"},{"formal-name":"aerials-won","value":"8"},{"formal-name":"passes-long-total","value":"30"},{"formal-name":"crosses-total","value":"12"},{"formal-name":"attempts-obox","value":"3"},{"formal-name":"attempts-ibox","value":"17"},{"formal-name":"tackles-won-percentage","value":"0.762"},{"formal-name":"passes-total","value":"537"},{"formal-name":"clearances","value":"17"},{"formal-name":"interceptions","value":"12"},{"formal-name":"passing-accuracy","value":"0.909"},{"formal-name":"crosses-accuracy","value":"0.583"},{"formal-name":"shooting-accuracy","value":"0.2"},{"formal-name":"passing-accuracy-opp-half","value":"0.845"}],"sub_score":[{"period-value":"1","score":"2"},{"period-value":"2","score":"2"}],"stats_foul":{"fouls_commited":"12"},"team_stats_soccer":{"stats-soccer-defensive":{"shots-blocked":"3","interceptions":"12"},"line-formation":"433","stats-soccer-offensive":{"corner-kicks":"4","tackles-total":"21","passes-total":"537","tackles-lost":"5","shots-total":"20","tackles-won":"16","shots-on-goal-total":"9","free-kicks":"3","offsides":"2"},"stats-soccer-foul":{"fouls-commited":"12"}},"score":"4","score_opposing":"0","time_of_possession_percentage":"55.2","stats_defensive":{"interceptions":"12","shots_blocked":"3"},"event_outcome":"win","stats_offensive":{"tackles_lost":"5","shots_on_goal_total":"9","tackles_total":"21","free_kicks":"3","corner_kicks":"4","offsides":"2","tackles_won":"16","passes_total":"537","shots_total":"20"}},"name":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"assitant":[]},"tournament_type":"Unknown","match_id":"872272c6e436864288764cd51e860e993ca3bdf9fb5a3de12fe6f769","event_name":"Paris Saint-Germain vs Dijon","season":2020,"start_time":"2020-10-24T19:00:00.000Z","eventkey":2094719,"substitutions":[{"player_position_out":"midfielder","minutes_elapsed":"55","player_position_in":"midfielder","period":"2","player_in":"Pape Cheikh Diop Gueye","team":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"},"substitution_reason":"Tactical","player_out":"Wesley Lautoa"},{"player_position_out":"midfielder","minutes_elapsed":"59","player_position_in":"midfielder","period":"2","player_in":"Ander Herrera","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Injury","player_out":"Julian Draxler"},{"player_position_out":"forward","minutes_elapsed":"70","player_position_in":"midfielder","period":"2","player_in":"Bersant Celina","team":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"},"substitution_reason":"Tactical","player_out":"Moussa Konaté"},{"player_position_out":"midfielder","minutes_elapsed":"73","player_position_in":"midfielder","period":"2","player_in":"Kays Ruiz-Atil","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Tactical","player_out":"Marquinhos"},{"player_position_out":"forward","minutes_elapsed":"73","player_position_in":"forward","period":"2","player_in":"Kylian Mbappé","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Injury","player_out":"Moise Kean"},{"player_position_out":"defender","minutes_elapsed":"79","player_position_in":"defender","period":"2","player_in":"Fouad Chafik","team":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"},"substitution_reason":"Tactical","player_out":"Sacha Boey"},{"player_position_out":"forward","minutes_elapsed":"79","player_position_in":"forward","period":"2","player_in":"Aurelien Scheidler","team":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"},"substitution_reason":"Tactical","player_out":"Mama Baldé"},{"player_position_out":"midfielder","minutes_elapsed":"85","player_position_in":"midfielder","period":"2","player_in":"Bandiougou Fadiga","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"},"substitution_reason":"Tactical","player_out":"Rafinha"}],"stadium":"Parc des Princes","officials":[{"lastname":"Hamel","full":"Johan Hamel","role":"main-official","first":"Johan"}],"result":[4,0],"event_outcome_type":"regular","scores":[{"minutes_elapsed":"3","participants":[{"player":{"abbreviation":"Kean","position":"forward","full":"Moise Kean","last":"Kean","first":"Moise"},"role":"scorer"},{"player":{"abbreviation":"Bakker","position":"defender","full":"Mitchel Bakker","last":"Bakker","first":"Mitchel"},"role":"assist"}],"score_type":"regular","period":"1","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"minutes_elapsed":"23","participants":[{"player":{"abbreviation":"Kean","position":"forward","full":"Moise Kean","last":"Kean","first":"Moise"},"role":"scorer"},{"player":{"abbreviation":"Santos Júnior","position":"forward","full":"Neymar","last":"Santos Júnior","first":"Neymar da Silva"},"role":"assist"}],"score_type":"regular","period":"1","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"minutes_elapsed":"82","participants":[{"player":{"abbreviation":"Mbappé","position":"forward","full":"Kylian Mbappé","last":"Mbappé","first":"Kylian"},"role":"scorer"},{"player":{"abbreviation":"Santos Júnior","position":"forward","full":"Neymar","last":"Santos Júnior","first":"Neymar da Silva"},"role":"assist"}],"score_type":"regular","period":"2","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}},{"minutes_elapsed":"88","participants":[{"player":{"abbreviation":"Mbappé","position":"forward","full":"Kylian Mbappé","last":"Mbappé","first":"Kylian"},"role":"scorer"},{"player":{"abbreviation":"Sarabia","position":"forward","full":"Pablo Sarabia","last":"Sarabia","first":"Pablo"},"role":"assist"}],"score_type":"regular","period":"2","team":{"abbrev":"PAR","full":"Paris Saint-Germain","first":"Paris Saint-Germain"}}],"date":"2020-10-24","penalties":[{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-card","minutes_elapsed":"46","period":"1","player":{"abbreviation":"Konaté","position":"forward","full":"Moussa Konaté","last":"Konaté","first":"Moussa"},"recipient_type":"player","team":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"}},{"comment":"Foul","penalty_type":"foul","penalty_level":"yellow-card","minutes_elapsed":"69","period":"2","player":{"abbreviation":"Panzo","position":"defender","full":"Jonathan Panzo","last":"Panzo","first":"Jonathan"},"recipient_type":"player","team":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"}}],"extra_time":"2","tournament_name":"French Ligue 1","visitant_team":{"players":[{"status":"starter","full":"Saturnin Allagbe","last":"Allagbe","time_played_total":"90","uniform_number":"16","stats":{"touches":"41","stats_soccer_defensive":{"catches-punches":"4","saves":"5","goals-against-total":"4","save-percentage":"2.5"},"stats_soccer_foul":{},"stats_defensive":{"saves":"5","catches_punches":"4","goals_against_total":"4","save_percentage":"2.5"},"stats_soccer_offensive":{"passes-total":"30","passes-complete-long":"8","passes-complete":"25","passes-incomplete":"5"},"stats_foul":{},"stats_offensive":{"passes_complete":"25","passes_complete_long":"8","passes_incomplete":"5","passes_total":"30"}},"position":"goalkeeper","first":"Saturnin"},{"status":"starter","full":"Sacha Boey","last":"Boey","time_played_total":"79","uniform_number":"2","stats":{"touches":"68","stats_soccer_defensive":{"clearances-successful":"3","goals-against-total":"2","interceptions":"2"},"stats_soccer_foul":{"fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"2","interceptions":"2","clearances_successful":"3"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"13","tackles-total":"3","passes-total":"46","tackles-lost":"1","passes-incomplete":"4","shots-total":"1","passes-complete-long":"1","tackles-won":"2","passes-complete":"42"},"stats_foul":{"fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"1","tackles_total":"3","passes_complete":"42","passes_complete_long":"1","passes_incomplete":"4","tackles_won":"2","passes_complete_3rd_final":"13","passes_total":"46","crosses_18_yard_plus":"1","shots_total":"1"}},"position":"defender","first":"Sacha"},{"status":"starter","full":"Bruno Ecuele Manga","last":"Ecuele Manga","time_played_total":"90","uniform_number":"25","stats":{"touches":"38","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"4","interceptions":"1","shots-blocked-outfielder":"1"},"stats_soccer_offensive":{"tackles-total":"2","passes-total":"27","shots-off-goal-total":"1","passes-incomplete":"3","tackles-lost":"0","shots-total":"2","passes-complete-long":"1","tackles-won":"2","passes-complete":"24"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"shots_blocked_outfielder":"1","goals_against_total":"4","interceptions":"1","clearances_successful":"1"},"aerials_won":"1","stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"0","shots_off_goal_total":"1","tackles_total":"2","passes_complete":"24","passes_complete_long":"1","passes_incomplete":"3","tackles_won":"2","passes_total":"27","shots_total":"2"}},"position":"defender","first":"Bruno"},{"status":"starter","full":"Jonathan Panzo","last":"Panzo","time_played_total":"90","uniform_number":"4","stats":{"touches":"50","stats_soccer_defensive":{"shots-blocked-cross":"1","clearances-successful":"1","goals-against-total":"4","shots-blocked-outfielder":"1"},"stats_soccer_offensive":{"shots-total":"1","passes-total":"45","shots-on-goal-total":"1","passes-complete":"43","passes-incomplete":"2"},"stats_soccer_foul":{"fouls-commited":"2","cautions-total":"1"},"stats_defensive":{"shots_blocked_cross":"1","shots_blocked_outfielder":"1","goals_against_total":"4","clearances_successful":"1"},"aerials_won":"1","stats_foul":{"fouls_commited":"2","cautions_total":"1"},"stats_offensive":{"passes_complete":"43","passes_incomplete":"2","passes_total":"45","shots_on_goal_total":"1","shots_total":"1"}},"position":"defender","first":"Jonathan"},{"status":"starter","full":"Ngonda Muzinga","last":"Muzinga","time_played_total":"90","uniform_number":"3","stats":{"touches":"73","stats_soccer_defensive":{"clearances-successful":"2","goals-against-total":"4","interceptions":"4"},"stats_soccer_foul":{"fouls-commited":"2"},"stats_defensive":{"goals_against_total":"4","interceptions":"4","clearances_successful":"2"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"3","tackles-total":"3","passes-total":"54","tackles-lost":"1","passes-incomplete":"6","passes-complete-long":"1","tackles-won":"2","passes-complete":"48"},"stats_foul":{"fouls_commited":"2"},"stats_offensive":{"tackles_lost":"1","tackles_total":"3","passes_complete":"48","passes_complete_long":"1","passes_incomplete":"6","passes_complete_3rd_final":"3","passes_total":"54","crosses_18_yard_plus":"1","tackles_won":"2"}},"position":"defender","first":"Ngonda"},{"status":"starter","full":"Didier Ndong","last":"Ndong","time_played_total":"90","uniform_number":"22","stats":{"touches":"59","stats_soccer_defensive":{"goals-against-total":"4"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"4"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"10","tackles-total":"2","passes-total":"49","tackles-lost":"0","passes-incomplete":"3","passes-complete-long":"3","tackles-won":"2","passes-complete":"46","crosses-18-yard":"2"},"stats_foul":{"fouls_commited":"1","fouls_suffered":"2"},"stats_offensive":{"tackles_lost":"0","tackles_total":"2","passes_complete":"46","passes_complete_long":"3","passes_incomplete":"3","crosses_18_yard":"2","passes_complete_3rd_final":"10","passes_total":"49","crosses_18_yard_plus":"1","tackles_won":"2"}},"position":"midfielder","first":"Didier"},{"status":"starter","full":"Wesley Lautoa","last":"Lautoa","time_played_total":"55","uniform_number":"24","stats":{"touches":"21","stats_soccer_defensive":{"shots-blocked-outfielder":"1","goals-against-total":"2","interceptions":"1"},"stats_soccer_foul":{"fouls-commited":"3"},"stats_defensive":{"goals_against_total":"2","shots_blocked_outfielder":"1","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"1","passes-total":"17","shots-off-goal-total":"1","passes-incomplete":"1","shots-total":"1","passes-complete-long":"3","passes-complete":"16"},"stats_foul":{"fouls_commited":"3"},"stats_offensive":{"shots_off_goal_total":"1","passes_complete":"16","passes_total":"17","passes_incomplete":"1","passes_complete_3rd_final":"1","passes_complete_long":"3","shots_total":"1"}},"position":"midfielder","first":"Wesley"},{"status":"starter","full":"Éric Ebimbe","last":"Ebimbe","time_played_total":"90","uniform_number":"8","stats":{"touches":"54","stats_soccer_defensive":{"goals-against-total":"4"},"stats_soccer_foul":{"fouls-commited":"5","fouls-suffered":"2"},"stats_defensive":{"goals_against_total":"4"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"8","passes-total":"31","shots-off-goal-total":"2","passes-incomplete":"4","shots-total":"4","shots-on-goal-total":"1","passes-complete":"27","crosses-18-yard":"1"},"stats_foul":{"fouls_commited":"5","fouls_suffered":"2"},"stats_offensive":{"shots_on_goal_total":"1","shots_off_goal_total":"2","passes_complete":"27","passes_incomplete":"4","crosses_18_yard":"1","passes_complete_3rd_final":"8","passes_total":"31","crosses_18_yard_plus":"1","shots_total":"4"}},"position":"midfielder","first":"Éric"},{"status":"starter","full":"Mama Baldé","last":"Baldé","time_played_total":"79","uniform_number":"17","stats":{"touches":"30","stats_soccer_defensive":{"clearances-successful":"1","goals-against-total":"2"},"stats_soccer_offensive":{"passes-complete-3rd-final":"1","passes-total":"15","shots-off-goal-total":"4","passes-incomplete":"3","shots-total":"5","passes-complete":"12","crosses-18-yard":"1"},"stats_soccer_foul":{"fouls-commited":"1","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"2","clearances_successful":"1"},"aerials_won":"1","stats_foul":{"fouls_commited":"1","fouls_suffered":"1"},"stats_offensive":{"shots_off_goal_total":"4","passes_complete":"12","passes_incomplete":"3","crosses_18_yard":"1","passes_complete_3rd_final":"1","passes_total":"15","shots_total":"5"}},"position":"forward","first":"Mama Samba"},{"status":"starter","full":"Moussa Konaté","last":"Konaté","time_played_total":"70","uniform_number":"11","stats":{"touches":"19","stats_soccer_defensive":{"goals-against-total":"2","interceptions":"1"},"stats_soccer_offensive":{"passes-complete-3rd-final":"1","tackles-total":"1","passes-total":"9","tackles-lost":"0","passes-incomplete":"0","shots-total":"1","passes-complete-long":"1","tackles-won":"1","passes-complete":"9"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"2","cautions-total":"1"},"stats_defensive":{"goals_against_total":"2","interceptions":"1"},"aerials_won":"1","stats_foul":{"fouls_commited":"2","fouls_suffered":"2","cautions_total":"1"},"stats_offensive":{"tackles_lost":"0","tackles_total":"1","passes_complete":"9","passes_complete_long":"1","passes_incomplete":"0","tackles_won":"1","passes_complete_3rd_final":"1","passes_total":"9","shots_total":"1"}},"position":"forward","first":"Moussa"},{"status":"starter","full":"Mounir Chouiar","last":"Chouiar","time_played_total":"90","uniform_number":"21","stats":{"touches":"74","stats_soccer_defensive":{"goals-against-total":"4","interceptions":"2"},"stats_soccer_offensive":{"crosses-18-yard-plus":"2","passes-complete-3rd-final":"9","tackles-total":"4","passes-total":"36","tackles-lost":"2","passes-incomplete":"8","shots-total":"1","passes-complete-long":"1","tackles-won":"2","shots-on-goal-total":"1","passes-complete":"28","crosses-18-yard":"2","free-kicks":"1"},"stats_soccer_foul":{"fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"4","interceptions":"2"},"aerials_won":"1","stats_foul":{"fouls_suffered":"1"},"stats_offensive":{"tackles_lost":"2","shots_on_goal_total":"1","tackles_total":"4","passes_complete":"28","passes_complete_long":"1","passes_incomplete":"8","tackles_won":"2","free_kicks":"1","crosses_18_yard":"2","passes_complete_3rd_final":"9","passes_total":"36","crosses_18_yard_plus":"2","shots_total":"1"}},"position":"forward","first":"Mounir"},{"status":"bench","full":"Anthony Racioppi","last":"Racioppi","uniform_number":"1","position":"goalkeeper","first":"Anthony"},{"status":"bench","full":"Senou Coulibaly","last":"Coulibaly","uniform_number":"5","position":"defender","first":"Senou"},{"status":"bench","full":"Pape Cheikh Diop Gueye","last":"Diop Gueye","time_played_total":"35","uniform_number":"6","stats":{"touches":"42","stats_soccer_defensive":{"goals-against-total":"2","interceptions":"2"},"stats_soccer_foul":{"fouls-commited":"2","fouls-suffered":"1"},"stats_defensive":{"goals_against_total":"2","interceptions":"2"},"stats_soccer_offensive":{"passes-total":"38","passes-complete-3rd-final":"4","passes-complete-long":"1","passes-complete":"33","passes-incomplete":"5"},"stats_foul":{"fouls_commited":"2","fouls_suffered":"1"},"stats_offensive":{"passes_complete":"33","passes_complete_long":"1","passes_complete_3rd_final":"4","passes_total":"38","passes_incomplete":"5"}},"position":"midfielder","first":"Pape Cheikh"},{"status":"bench","full":"Frédéric Sammaritano","last":"Sammaritano","uniform_number":"7","position":"midfielder","first":"Frédéric"},{"status":"bench","full":"Bersant Celina","last":"Celina","time_played_total":"20","uniform_number":"9","stats":{"touches":"16","stats_soccer_defensive":{"goals-against-total":"2"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"2"},"stats_soccer_offensive":{"passes-total":"14","crosses-18-yard":"1","passes-complete":"14","passes-incomplete":"0"},"stats_foul":{},"stats_offensive":{"passes_complete":"14","crosses_18_yard":"1","passes_incomplete":"0","passes_total":"14"}},"position":"midfielder","first":"Bersant"},{"status":"bench","full":"Arthur Zagre","last":"Zagre","uniform_number":"12","position":"defender","first":"Arthur"},{"status":"bench","full":"Jordan Marié","last":"Marié","uniform_number":"14","position":"midfielder","first":"Jordan"},{"status":"bench","full":"Fouad Chafik","last":"Chafik","time_played_total":"11","uniform_number":"26","stats":{"touches":"6","stats_soccer_defensive":{"goals-against-total":"2"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"2"},"stats_soccer_offensive":{"crosses-18-yard-plus":"1","passes-complete-3rd-final":"1","passes-total":"4","passes-incomplete":"0","passes-complete-long":"1","passes-complete":"4"},"stats_foul":{},"stats_offensive":{"passes_complete":"4","passes_total":"4","passes_incomplete":"0","passes_complete_3rd_final":"1","passes_complete_long":"1","crosses_18_yard_plus":"1"}},"position":"defender","first":"Fouad"},{"status":"bench","full":"Aurelien Scheidler","last":"Scheidler","time_played_total":"11","uniform_number":"27","stats":{"touches":"5","stats_soccer_defensive":{"goals-against-total":"2"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"2"},"stats_soccer_offensive":{"passes-total":"4","passes-complete-3rd-final":"1","passes-complete":"4","passes-incomplete":"0"},"stats_foul":{},"stats_offensive":{"passes_complete":"4","passes_complete_3rd_final":"1","passes_total":"4","passes_incomplete":"0"}},"position":"forward","first":"Aurelien"}],"image":"https://st1.uvnimg.com/97/dc/9e0262b043c082e24a041bced4bc/3298-el.png","stats":{"sports_property":[{"formal-name":"duels-won","value":"40"},{"formal-name":"aerials-won","value":"5"},{"formal-name":"passes-long-total","value":"37"},{"formal-name":"crosses-total","value":"25"},{"formal-name":"attempts-obox","value":"5"},{"formal-name":"attempts-ibox","value":"11"},{"formal-name":"tackles-won-percentage","value":"0.733"},{"formal-name":"passes-total","value":"419"},{"formal-name":"clearances","value":"8"},{"formal-name":"interceptions","value":"13"},{"formal-name":"passing-accuracy","value":"0.895"},{"formal-name":"crosses-accuracy","value":"0.32"},{"formal-name":"shooting-accuracy","value":"0"},{"formal-name":"passing-accuracy-opp-half","value":"0.781"}],"sub_score":[{"period-value":"1","score":"0"},{"period-value":"2","score":"0"}],"stats_foul":{"fouls_commited":"18","cautions_total":"2"},"team_stats_soccer":{"stats-soccer-defensive":{"shots-blocked":"5","goals-against-total":"4","interceptions":"13"},"line-formation":"433","stats-soccer-offensive":{"corner-kicks":"10","tackles-total":"15","passes-total":"419","tackles-lost":"4","shots-total":"16","tackles-won":"11","shots-on-goal-total":"3","free-kicks":"1"},"stats-soccer-foul":{"fouls-commited":"18","cautions-total":"2"}},"score":"0","score_opposing":"4","time_of_possession_percentage":"44.8","stats_defensive":{"goals_against_total":"4","interceptions":"13","shots_blocked":"5"},"event_outcome":"loss","stats_offensive":{"tackles_lost":"4","shots_on_goal_total":"3","tackles_total":"15","free_kicks":"1","corner_kicks":"10","tackles_won":"11","passes_total":"419","shots_total":"16"}},"name":{"abbrev":"DIJ","full":"Dijon","first":"Dijon"},"assitant":[]}}]
Bonjour,
Voilà qui est beaucoup plus clair
Plaisanterie mise à part, on n'a pas le choix. Il faut connaitre l'ensemble de la structure pour pouvoir écrire la ligne qui retrouve l'information.
Ce que tu donnes, c'est la totalité de ce qu'il y a dans $response ? Y a rien d'autre ?
Amicalement,
Modifié par parsimonhi (30 Oct 2020 - 10:18)
Voilà qui est beaucoup plus clair
Plaisanterie mise à part, on n'a pas le choix. Il faut connaitre l'ensemble de la structure pour pouvoir écrire la ligne qui retrouve l'information.
Ce que tu donnes, c'est la totalité de ce qu'il y a dans $response ? Y a rien d'autre ?
Amicalement,
Modifié par parsimonhi (30 Oct 2020 - 10:18)
En fait dans la partie stats je cherche a extraire les buteurs du match (qui est, selon moi, ce qui est contenu dans la partie "goals total" - j'ai fait au préalable une recherche goals total et ça ressort bien les 2 buteurs du match et le nombre de buts que chacun à inscrit, ce qui me permet humblement de penser que c'est la bonne donnée)
Modifié par michel4-7 (30 Oct 2020 - 10:30)
Modifié par michel4-7 (30 Oct 2020 - 10:30)
En fait sur la portion de données que j'ai copiées toute a l'heure (et que je remets)
Le tout dernier argument (je ne sais pas si j'emploie le bon terme), est un goals_total (et non un goals-total que j'ai pris plus haut) et je me demande s'il ne faut pas extraire la donnée dessus J'ai essayé mais j'ai toujours des messages d'erreur
{"status":"bench","full":"Kylian Mbappé","last":"Mbappé","time_played_total":"17","uniform_number":"7","stats":{"touches":"13","stats_soccer_defensive":{"goals-against-total":"0"},"stats_soccer_foul":{},"stats_defensive":{"goals_against_total":"0"},"stats_soccer_offensive":{"goals-left-foot":"0","passes-complete-3rd-final":"4","passes-total":"10","passes-incomplete":"0","shots-total":"2","goals-total":"2","shots-on-goal-total":"2","passes-complete":"10","goals-right-foot":"0","goals-head":"0"},"stats_foul":{},"stats_offensive":{"goals_right_foot":"0","shots_on_goal_total":"2","passes_complete":"10","goals_left_foot":"0","passes_incomplete":"0","shots_total":"2","goals_head":"0","passes_complete_3rd_final":"4","passes_total":"10","goals_total":"2"}},"position":"forward","first":"Kylian"},
Le tout dernier argument (je ne sais pas si j'emploie le bon terme), est un goals_total (et non un goals-total que j'ai pris plus haut) et je me demande s'il ne faut pas extraire la donnée dessus J'ai essayé mais j'ai toujours des messages d'erreur
Bonjour,
Si je comprends bien le truc, ce que tu vas obtenir dans $response peut dépendre de ce que tu vas demander "auparavant" comme recherche ? Si c'est ça, on n'aura pas la même structure de données à chaque fois : tu vas t'amuser !
Bon, bref, avec la structure de données que tu as postée, les joueurs (de l'équipe qui reçoit) sont dans un tableau récupérable par :
$joueurs = $match->home_team->players;
Il faut donc à l'intérieur de la boucle principale, faire un deuxième foreach sur $joueurs, et tester s'ils ont la propriété goals_total.
Par exemple :
Amicalement,
Modifié par parsimonhi (30 Oct 2020 - 11:12)
Si je comprends bien le truc, ce que tu vas obtenir dans $response peut dépendre de ce que tu vas demander "auparavant" comme recherche ? Si c'est ça, on n'aura pas la même structure de données à chaque fois : tu vas t'amuser !
Bon, bref, avec la structure de données que tu as postée, les joueurs (de l'équipe qui reçoit) sont dans un tableau récupérable par :
$joueurs = $match->home_team->players;
Il faut donc à l'intérieur de la boucle principale, faire un deuxième foreach sur $joueurs, et tester s'ils ont la propriété goals_total.
Par exemple :
$response2=json_decode($response);
foreach($response2 as $match)
{
$joueurs = $match->home_team->players ;
foreach($joueurs as $joueur)
{
if($joueur->stats->stats_offensive->goals_total)
echo $joueur->full." : ".$joueur->stats->stats_offensive->goals_total."<br>";
}
}
Amicalement,
Modifié par parsimonhi (30 Oct 2020 - 11:12)
J'ai essayé le code, voici les messages d'erreur que j'ai (je précise que je fais tout sur xampp, ça n'a pas d'incidence. J'ai une version php 7.4)
Une précision : en fait la les données extraites sont les joueurs de l'équipe qui reçoit car l'équipe visiteuse n'a pas marqué sur ce match mais je souhaite afficher les buteurs des 2 équipes (oui je suis compliqué comme garçon )
Modifié par michel4-7 (30 Oct 2020 - 11:21)
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Moise Kean : 2
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'goals_total' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'goals_total' of non-object in C:\xampp\htdocs\stats.php on line 55
Kylian Mbappé : 2
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'goals_total' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'goals_total' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'goals_total' of non-object in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$goals_total in C:\xampp\htdocs\stats.php on line 55
Une précision : en fait la les données extraites sont les joueurs de l'équipe qui reçoit car l'équipe visiteuse n'a pas marqué sur ce match mais je souhaite afficher les buteurs des 2 équipes (oui je suis compliqué comme garçon )
Modifié par michel4-7 (30 Oct 2020 - 11:21)
Bonjour
Ok, mon test d'existence de goals_total n'était pas assez robuste.
Essaie ça :
Amicalement,
Ok, mon test d'existence de goals_total n'était pas assez robuste.
Essaie ça :
$response=file_get_contents("matches.txt");
$response2=json_decode($response);
foreach($response2 as $match)
{
$joueurs = $match->home_team->players ;
foreach($joueurs as $joueur)
{
if(property_exists($joueur->stats->stats_offensive,'goals_total'))
echo $joueur->full." : ".$joueur->stats->stats_offensive->goals_total."<br>";
}
}
Amicalement,
J'ai retrouvé mon contenu de $response (qui avait disparu sur le précédent code) et je n'ai plus que 2 messages
Warning: file_get_contents(matches.txt): failed to open stream: No such file or directory in C:\xampp\htdocs\stats.php on line 49
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\stats.php on line 51
Juste en enlevant la ligne précitée voici la liste des messages d'erreurs que j'obtiens
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\stats.php on line 55
Kylian Mbappé : 2
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\stats.php on line 55
Notice: Undefined property: stdClass::$stats in C:\xampp\htdocs\stats.php on line 55
Notice: Trying to get property 'stats_offensive' of non-object in C:\xampp\htdocs\stats.php on line 55
Warning: First parameter must either be an object or the name of an existing class in C:\xampp\htdocs\stats.php on line 55
Bonjour,
Il est trop capricieux ton php !
Voilà un code encore plus robuste :
Amicalement,
Il est trop capricieux ton php !
Voilà un code encore plus robuste :
$response2=json_decode($response);
foreach($response2 as $match)
{
$joueurs = $match->home_team->players ;
foreach($joueurs as $joueur)
{
if(property_exists($joueur,'stats')
&&property_exists($joueur->stats,'stats_offensive')
&&property_exists($joueur->stats->stats_offensive,'goals_total'))
echo $joueur->full." : ".$joueur->stats->stats_offensive->goals_total."<br>";
}
}
Amicalement,
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 !!!
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 !!!