Skip to content

Instantly share code, notes, and snippets.

@rossigee
Last active August 29, 2015 14:16
Show Gist options
  • Save rossigee/71189b88a97af3eeabf8 to your computer and use it in GitHub Desktop.
Save rossigee/71189b88a97af3eeabf8 to your computer and use it in GitHub Desktop.
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