<?php

//SessionId is the session which is to be terminated.
$params = "operation=logout&sessionName=$sessionId";

//logout must be GET Request.
$curl->get("$endpointUrl?$params");
$response = $curl->response;

//decode the json encode response from the server.
$jsonResponse = json_decode($response, true);

//operation was successful get the token from the reponse.
if($jsonResponse['success']==false)
    //handle the failure case.
    die('logout failed:'.$jsonResponse['errorMsg']);

//logout successful session terminated.

?>