Example #1
0
/**
 * @copyright Copyright 2013 Markus Kalkbrenner, bio.logis GmbH (https://www.biologis.com)
 * @license GPLv2
 * @author Markus Kalkbrenner <*****@*****.**>
 */
use biologis\HV\HVClient;
use biologis\HV\HVRawConnectorUserNotAuthenticatedException;
use biologis\HV\HVRawConnectorAuthenticationExpiredException;
require '../vendor/autoload.php';
$appId = file_get_contents('app.id');
session_start();
ob_start();
print "Connecting HealthVault ...<br><hr>";
ob_flush();
$hv = new HVClient($appId, $_SESSION);
try {
    ob_start();
    $hv->connect(file_get_contents('app.fp'), 'app.pem');
    $personInfo = $hv->getPersonInfo();
    $personId = $personInfo->person_id;
    $recordId = $personInfo->selected_record_id;
    print 'person-id: <b>' . $personId . '</b><br>';
    print 'name: <b>' . $personInfo->name . '</b><br>';
    print 'preferred-culture language: <b>' . $personInfo->preferred_culture->language . '</b><br>';
    print '<hr>';
    ob_flush();
    print '<br><a href="list_all_things.php">List all things</a>';
    print '<br><a href="files.php">Files example</a>';
    print '<br><a href="weight.php">Weight example</a>';
} catch (HVRawConnectorUserNotAuthenticatedException $e) {
/**
 * @copyright Copyright 2013 Markus Kalkbrenner, bio.logis GmbH (https://www.biologis.com)
 * @license GPLv2
 * @author Markus Kalkbrenner <*****@*****.**>
 */
use biologis\HV\HVClient;
use biologis\HV\HVRawConnector;
use biologis\HV\HVRawConnectorUserNotAuthenticatedException;
use biologis\HV\HVRawConnectorAuthenticationExpiredException;
require '../vendor/autoload.php';
$appId = file_get_contents('app.id');
session_start();
ob_start();
print "Connecting HealthVault ...<br><hr>";
ob_flush();
$hv = new HVClient($appId, $_SESSION);
try {
    ob_start();
    $hv->connect(file_get_contents('app.fp'), 'app.pem');
    $personInfo = $hv->getPersonInfo();
    $personId = $personInfo->person_id;
    $recordId = $personInfo->selected_record_id;
    print 'person-id: <b>' . $personId . '</b><br>';
    print 'name: <b>' . $personInfo->name . '</b><br>';
    print 'preferred-culture language: <b>' . $personInfo->preferred_culture->language . '</b><br>';
    print '<hr>';
    ob_flush();
    foreach (HVRawConnector::$things as $thingName => $thingId) {
        print "Thing: <b>{$thingName}</b><br>";
        $things = $hv->getThings($thingId, $recordId);
        foreach ($things as $thing) {
Example #3
0
/**
 * @copyright Copyright 2013 Markus Kalkbrenner, bio.logis GmbH (https://www.biologis.com)
 * @license GPLv2
 * @author Markus Kalkbrenner <*****@*****.**>
 */
use biologis\HV\HVClient;
use biologis\HV\HealthRecordItem\WeightMeasurement;
use biologis\HV\HVRawConnectorUserNotAuthenticatedException;
use biologis\HV\HVRawConnectorAuthenticationExpiredException;
require '../vendor/autoload.php';
$appId = file_get_contents('app.id');
session_start();
ob_start();
print "Connecting HealthVault ...<br><hr>";
ob_flush();
$hv = new HVClient($appId, $_SESSION);
try {
    ob_start();
    $hv->connect(file_get_contents('app.fp'), 'app.pem');
    $personInfo = $hv->getPersonInfo();
    $personId = $personInfo->person_id;
    $recordId = $personInfo->selected_record_id;
    print 'person-id: <b>' . $personId . '</b><br>';
    print 'name: <b>' . $personInfo->name . '</b><br>';
    print 'preferred-culture language: <b>' . $personInfo->preferred_culture->language . '</b><br>';
    print '<hr>';
    ob_flush();
    if (isset($_POST['submit']) && is_numeric($_POST['weight'])) {
        $weightMeasurement = WeightMeasurement::createFromData(time(), $_POST['weight']);
        $hv->putThings($weightMeasurement, $recordId);
    }