Example Code:
<?php
//The JSON data.
$jsonData = array(
'gameId' => $gameId,
'api_key' => $api_key
);
//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);
//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);
$handler = curl_init();
$access_token = "<access_token>";
$headers = array("Content-Type: application/json", "Content-Length: " . strlen($jsonDataEncoded));
curl_setopt($handler, CURLOPT_URL, $url . "fgs_RecordNewInstallation");
curl_setopt($handler, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($handler, CURLOPT_HTTPHEADER,$headers);
curl_setopt($handler, CURLOPT_POST, true);
curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($handler);
if($response !==false)
{
var_dump($response);
}
else {
print "Could not get a response";
}
?>
Response:
{"errorCodeList":[{"errorCodeList":[]}],"instanceId":"40163e0f-5fc4-4859-8e21-86b252372cb8","gamerHandle":"PLAYER1","handleLength":30}bool(true)