Merge pull request #60 from gnieark/dev

Dev
This commit is contained in:
Gnieark 2016-06-06 13:13:58 +02:00
commit 8ad13f4041
2 changed files with 7 additions and 6 deletions

View File

@ -36,9 +36,7 @@ switch ($_POST['act']){
}
get_IA_Response($bots[$bot1]['url'],$params[0]); //don't care about result
get_IA_Response($bots[$bot2]['url'],$params[1]); //don't care about result
//"game-id":"gameid","action":"init","game":"tictactoe","players":2,"board":null,"you":null,"player-index":0}
//[0000] body> {"name":"moul-tictactoe","play":null,"error":null}
$playerPlayingNow=1;
@ -68,7 +66,7 @@ switch ($_POST['act']){
'game' => 'tictactoe',
'players' => 2,
'board' => $map,
'you' => $playerCHAR,
'you' => $playerCHAR,
'player-index' =>$playerIndex
);
@ -126,7 +124,7 @@ switch ($_POST['act']){
$playerPlayingNow=1;
}
}else{
echo "<p>".$playerName." a fait une réponse non conforme. Il perd</p>";
echo "<p>".$playerName." a fait une réponse non conforme. Il perd.</p>";
break;
}

View File

@ -40,7 +40,9 @@ function get_IA_Response($iaUrl,$postParams){
$data_string = json_encode($postParams);
$ch = curl_init($iaUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
@ -49,5 +51,6 @@ function get_IA_Response($iaUrl,$postParams){
);
$output= curl_exec($ch);
curl_close($ch);
//echo $iaUrl." ".$data_string." ".$output.'<br/>';
return json_decode($output,TRUE);
}