---
title: Sample code
description: The application should capture the resumePath upon a GET request to this URL with code similar to the following:
component: php
page_id: php:setup:pf_php_ik_spssoacctlink_sample_code
canonical_url: https://docs.pingidentity.com/integrations/php/setup/pf_php_ik_spssoacctlink_sample_code.html
revdate: July 5, 2024
---

# Sample code

The application should capture the `resumePath` upon a `GET` request to this URL with code similar to the following:

```
 <?php
    # Use and instantiate an agent
    use pingidentity\opentoken\agent;
    $myagent = new Agent();

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

    # After the user has authenticated, an OpenToken needs to be
    # generated with the userId and sent back to the previously
    # captured resumePath.

    $myvalues = array(TOKEN_SUBJECT => $userInfo["userid"],
    AUTHN_CTX_ATTRIBUTE_NAME => $userInfo[AUTHN_CTX_ATTRIBUTE_NAME]);

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