zu bekommen, wie das LENDDO Punktzahl von REST-API in PHP
My client id = LEDEMO1070168781157742500
Für oben bekommen CLIENT_ID meine Lenddo Score 480 ist, die Anzeige auf dem Lenddo Armaturenbrett ist aber nicht über die API.
Nicht meine API und geheimen Schlüssel teilen.
Im Grunde brauche ich die Hilfe zum Generieren von AUTHORIZATION HEADER, die ich in der signRequest() Funktion ausführe.
Die Referenz = https://www.lenddo.com/documentation/rest_api.htmlWie die LENDDO Punktzahl von REST-API in PHP
/*
<?php
$method = "GET";
$date = date("D M j G:i:s T Y");
$url = '/ClientScore/LEDEMO1070168781157742500';
function signRequest($method, $body, $date, $url) {
$api = ''; //my api key
$secret = ''; // my secret key
$contentMd5 = NULL;
if(!empty($body)) {
$contentMd5 = md5($body);
}
$stringToSign = $method . "\n" . $contentMd5 . "\n" . $date . "\n" . $url;
$string = "LENDDO " . $api . ":";
$string .= base64_encode(
hash_hmac("sha1", $stringToSign, $secret, TRUE)
);
return $string;
}
$val = signRequest('GET', '', $date, $url); // get the access token
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://scoreservice.lenddo.com/ClientScore/LEDEMO1070168781157742500");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
$headers = array('Authorization: Bearer ' . $val);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
// the above source code gives me the output => string(141) "{"message": "Signature generated from request data does not match the signature provided in the Authorization Header.", "name": "FORBIDDEN"} "
// i pass my api and secret key into the code above but got this error, help me to find Lenddo Score.
?>