Skip to content

Instantly share code, notes, and snippets.

@rossigee
Created February 28, 2015 05:18
Show Gist options
  • Save rossigee/0bc794cb178f80efdc0c to your computer and use it in GitHub Desktop.
Save rossigee/0bc794cb178f80efdc0c to your computer and use it in GitHub Desktop.
Script for checking the details of a property
<?php
$application_token = "abcdef12-4855-11e4-a25f-06ee74823f7d";
# Get a visitor token
$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);
$usertoken = $response->token->token;
# Fetch property
$url = "https://www.cpd.co.uk/restapi/v1/property/1288825/";
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'X-CPD-Token: '.$usertoken
));
$rawdata = curl_exec($curl);
$response = json_decode($rawdata);
print_r($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment