Created
February 28, 2015 05:18
-
-
Save rossigee/0bc794cb178f80efdc0c to your computer and use it in GitHub Desktop.
Script for checking the details of a property
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"; | |
# 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