コード例 #1
0
    $options = [];
    $pFFA = new adriangibbons\phpFITFileAnalysis(__DIR__ . $file, $options);
    // Google Time Zone API
    $date = new DateTime('now', new DateTimeZone('UTC'));
    $date_s = $pFFA->data_mesgs['session']['start_time'];
    $url_tz = "https://maps.googleapis.com/maps/api/timezone/json?location=" . reset($pFFA->data_mesgs['record']['position_lat']) . ',' . reset($pFFA->data_mesgs['record']['position_long']) . "&timestamp=" . $date_s . "&key=AIzaSyDlPWKTvmHsZ-X6PGsBPAvo0nm1-WdwuYE";
    $result = file_get_contents("{$url_tz}");
    $json_tz = json_decode($result);
    if ($json_tz->status == "OK") {
        $date_s = $date_s + $json_tz->rawOffset + $json_tz->dstOffset;
    }
    $date->setTimestamp($date_s);
    $crank_length = 0.175;
    $ftp = 329;
    $selected_cadence = 90;
    $json = $pFFA->getJSON($crank_length, $ftp, ['all'], $selected_cadence);
} catch (Exception $e) {
    echo 'caught exception: ' . $e->getMessage();
    die;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>phpFITFileAnalysis demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/dc.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>