Last active
August 29, 2015 14:16
-
-
Save rossigee/71189b88a97af3eeabf8 to your computer and use it in GitHub Desktop.
Obtaining a visitor token with an agent application token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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