1. Go to this page and download the library: Download queueit/knownuserv3 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
queueit / knownuserv3 example snippets
$configText = file_get_contents('integrationconfig.json');
$customerID = ""; //Your Queue-it customer ID
$secretKey = ""; //Your 72 char secret key as specified in Go Queue-it self-service platform
$queueittoken = isset( $_GET["queueittoken"] )? $_GET["queueittoken"] :'';
try
{
$fullUrl = getFullRequestUri();
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
//Verify if the user has been through the queue
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByIntegrationConfig(
$currentUrlWithoutQueueitToken, $queueittoken, $configText, $customerID, $secretKey);
if($result->doRedirect())
{
//Adding no cache headers to prevent browsers to cache requests
header("Expires:Fri, 01 Jan 1990 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
//end
if(!$result->isAjaxResult)
{
//Send the user to the queue - either because hash was missing or because is was invalid
header('Location: ' . $result->redirectUrl);
}
else
{
header('HTTP/1.0: 200');
header($result->getAjaxQueueRedirectHeaderKey() . ': ' . $result->getAjaxRedirectUrl());
header("Access-Control-Expose-Headers" . ': ' . $result->getAjaxQueueRedirectHeaderKey());
}
die();
}
if(!empty($queueittoken) && $result->actionType == "Queue")
{
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
header('Location: ' . $currentUrlWithoutQueueitToken);
die();
}
}
catch(\Exception $e)
{
// There was an error validating the request
// Use your own logging framework to log the error
// This was a configuration error, so we let the user continue
}
function getFullRequestUri()
{
// Get HTTP/HTTPS (the possible values for this vary from server to server)
$myUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && !in_array(strtolower($_SERVER['HTTPS']),array('off','no'))) ? 'https' : 'http';
// Get domain portion
$myUrl .= '://'.$_SERVER['HTTP_HOST'];
// Get path to script
$myUrl .= $_SERVER['REQUEST_URI'];
// Add path info, if any
if (!empty($_SERVER['PATH_INFO'])) $myUrl .= $_SERVER['PATH_INFO'];
return $myUrl;
}
$customerID = ""; //Your Queue-it customer ID
$secretKey = ""; //Your 72 char secret key as specified in Go Queue-it self-service platform
$eventConfig = new QueueIT\KnownUserV3\SDK\QueueEventConfig();
$eventConfig->eventId = ""; // ID of the queue to use
$eventConfig->queueDomain = "xxx.queue-it.net"; //Domain name of the queue.
//$eventConfig->cookieDomain = ".my-shop.com"; //Optional - Domain name where the Queue-it session cookie should be saved.
$eventConfig->cookieValidityMinute = 15; //Validity of the Queue-it session cookie should be positive number.
$eventConfig->extendCookieValidity = true; //Should the Queue-it session cookie validity time be extended each time the validation runs?
//$eventConfig->culture = "da-DK"; //Optional - Culture of the queue layout in the format specified here: https://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx. If unspecified then settings from Event will be used.
// $eventConfig->layoutName = "NameOfYourCustomLayout"; //Optional - Name of the queue layout. If unspecified then settings from Event will be used.
$queueittoken = isset( $_GET["queueittoken"] )? $_GET["queueittoken"] :'';
try
{
$fullUrl = getFullRequestUri();
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
//Verify if the user has been through the queue
$result = QueueIT\KnownUserV3\SDK\KnownUser::resolveQueueRequestByLocalConfig(
$currentUrlWithoutQueueitToken, $queueittoken, $eventConfig, $customerID, $secretKey);
if($result->doRedirect())
{
//Adding no cache headers to prevent browsers to cache requests
header("Expires:Fri, 01 Jan 1990 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
//end
if(!$result->isAjaxResult)
{
//Send the user to the queue - either because hash was missing or because is was invalid
header('Location: ' . $result->redirectUrl);
}
else
{
header('HTTP/1.0: 200');
header($result->getAjaxQueueRedirectHeaderKey() . ': '. $result->getAjaxRedirectUrl());
header("Access-Control-Expose-Headers" . ': ' . $result->getAjaxQueueRedirectHeaderKey());
}
die();
}
if(!empty($queueittoken) && $result->actionType == "Queue")
{
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
header('Location: ' . $currentUrlWithoutQueueitToken);
die();
}
}
catch(\Exception $e)
{
// There was an error validating the request
// Use your own logging framework to log the error
// This was a configuration error, so we let the user continue
}
// Default implementation of HttpRequestProvider always returns empty string as request body.
// Use following line to set a custom httpRequestBodyProvider
QueueIT\KnownUserV3\SDK\KnownUser::setHttpRequestProvider(new HttpRequestBodyProvider());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.