Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Obtaining a visitor token with an agent application token
<?php
$application_token = "abcdef12-4855-11e4-a25f-06ee74823f7d";
$url = "https://www.cpd.co.uk/restapi/v1/agents/visitortoken/";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'X-CPD-Token: '.$application_token
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$rawdata = curl_exec($curl);
$response = json_decode($rawdata);
$visitortoken = $response->token->token;
print $visitortoken;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment