Below is an example code snippet for processing a logout request and redirecting the user's browser back to PingFederate:

 <?php    
     # Use and instantiate an agent    
     use pingidentity\opentoken\agent;    
     $myagent = new Agent();   
   
     # Setup an array of values    
     $myvalues = array(TOKEN_SUBJECT => “user1”);    

     # Generate and write the token to a string (assuming that's    
     # our configuration)    
     $queryParam = $myagent->writeTokenToHTTPResponse($myvalues);      

     $resumePath = $_GET['resume'];    
     $returnUrl = "https://<SERVER_NAME>:9031/" . $resumePath;      

     session_destroy();    
     ob_end_clean();      

     if ($queryParam)    
     {      
       if (strpos($returnUrl, "?") == FALSE)      
       {        
         $returnUrl = $returnUrl . "?";      
       }      
       $returnUrl = $returnUrl . $queryParam;    
     }     
 
     header("Location: " . $returnUrl); 
 ?>