I could do with some help with this call formatted in PHP. What have I done wrong?
<?PHP
$creds = '<<email>>:<<password>>';
$url = '
https://hsp-prod.rockshore.net/api/v1/serviceMetrics';
$data_array = array("from_loc"=>"BTN","to_loc"=>"VIC","from_time"=>"0700","to_time"=>"0800","from_date"=>"2016-07-01","to_date"=>"2016-08-01","days"=>"WEEKDAY");
$data = json_encode($data_array);
echo $data;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Basic {Base64($creds)}',
'Content-Type: application/json',
'Host:
hsp-prod.rockshore.net',
'Content-Length: ' . strlen($data))
);
$result = curl_exec($ch);
//echo json_decode($result);
echo $result;
?>
This returns a message Failed to decode basic access token. Thanks, Nick