Hasil yang dikembalikan oleh Garmin Health Api ialah tatasusunan kosong
<p>Apabila menggunakan API kesihatan Garmin, saya mendapat tatasusunan respons kosong, tiada ralat dipaparkan dan hanya tatasusunan kosong dikembalikan saya keliru dan tidak menemui sebarang penyelesaian ;
<pre class="brush:php;toolbar:false;">fungsi statik awam get_garmin_health_data(Minta $request)
{
// dd(tarikh('Y-m-d H:i:s'));
$garmin_consumer_key = env('CONSUMERKEY');
$garmin_consumer_secret = env('CONSUMERSECRET');
$twitter_access_token = $request->oauth_token ??
$twitter_access_token_secret = $request->oauth_token_secret ??
$twitter_version = '1.0';
$sign_method = 'HMAC-SHA1';
date_default_timezone_set('Asia/kolkata');
// $end_time = Carbon::now()->timestamp; // Hasilkan cap masa yang serupa dengan 1552296328
// $start_time = Karbon::now()->subDays(1)->timestamp;
$start_time = strtotime('-20 jam');
$end_time = masa();
// dd($mula_masa);
// $time = $request->oauth_nonce;
$masa = masa();
// $post = '{"event":{"type":"message_create","message_create":{"target":{"recipient_id":"123"},"message_data" :{"teks":"Hello dunia"}}}}';
$post = '{}';
$url = 'https://apis.garmin.com/wellness-api/rest/dailies';
$param_string = 'oauth_consumer_key=' . $garmin_consumer_key .
'&oauth_nonce=' . $masa.
'&oauth_signature_method=' . $kaedah_tanda .
'&oauth_timestamp=' . $masa.
'&oauth_token=' . $twitter_access_token .
'&oauth_version=' . $twitter_version .
'&uploadEndTimeInSeconds=' . $end_time .
'&uploadStartTimeInSeconds=' . $start_time;
// 为POST生成签名基本字符串
$base_string = 'GET&' . rawurlencode($url) . '&' . rawurlencode($param_string);
// dd($base_string);
$tanda_kunci = rawurlencode($garmin_consumer_secret) . '&' . rawurlencode($twitter_access_token_secret);
// 生成唯一签名
$signature = base64_encode(hash_hmac('sha1', $base_string, $sign_key, true));
$curl_header = 'OAuth oauth_consumer_key="' . rawurlencode($garmin_consumer_key) . '", ' .
'oauth_nonce="' . rawurlencode($time) . '", ' .
'oauth_signature="' . rawurlencode($signature) . '", ' .
'oauth_signature_method="' . $kaedah_tanda . '", ' .
'oauth_timestamp="' . rawurlencode($time) . '", ' .
'oauth_token="' . rawurlencode($twitter_access_token) . '", ' .
'oauth_version="' . $twitter_version . '"';
$url2 = 'https://apis.garmin.com/wellness-api/rest/dailies?uploadStartTimeInSeconds=' . $start_time . '&uploadEndTimeInSeconds=' . $end_time;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url2,
CURLOPT_RETURNTRANSFER => benar,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => benar,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DAPAT',
CURLOPT_HTTPHEADER => tatasusunan(
'Kebenaran:' . $curl_header,
),
));
$respon = curl_exec($curl);
dd($respon);
curl_close($curl);
$res = json_decode($respons);</pre>
<p>请为这个问题提供一个解决方案,如果可能的话,用PHP或CURL请求进行回答。