From cc695b9069ab0757d707d6797beaeb3f37bb2c89 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sun, 29 May 2016 22:43:45 +0200 Subject: [PATCH] full JSON --- src/arenas/tictactoe/act.php | 5 ++--- src/arenas/tictactoe/functions.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/arenas/tictactoe/act.php b/src/arenas/tictactoe/act.php index 39c6711..a520ad7 100644 --- a/src/arenas/tictactoe/act.php +++ b/src/arenas/tictactoe/act.php @@ -72,9 +72,8 @@ switch ($_POST['act']){ 'player-index' =>$playerIndex ); - $httpResponse=json_decode(get_IA_Response($playerURL,$paramsToSend),TRUE); - $playerResponse=$httpResponse['play']; - echo "

******".$playerResponse."**********

"; + $playerResponse=get_IA_Response($playerURL,$paramsToSend)['play']; + //tester la validité de la réponse if((isset($map[$playerResponse])) && ($map[$playerResponse]=="")){ //reponse conforme diff --git a/src/arenas/tictactoe/functions.php b/src/arenas/tictactoe/functions.php index 15ee9b2..6d78ea3 100644 --- a/src/arenas/tictactoe/functions.php +++ b/src/arenas/tictactoe/functions.php @@ -51,5 +51,5 @@ function get_IA_Response($iaUrl,$postParams){ curl_close($ch); echo '

'.$data_string.'

'; echo '

'.$output.'

'; - return htmlentities($output); + return json_decode($output,TRUE); } \ No newline at end of file