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']) && 'Upload' == $_POST['submit'] && !empty($_FILES['thefile']['tmp_name'])) { $stream = fopen($_FILES['thefile']['tmp_name'], 'r'); $file = File::createFromStream($stream, $_FILES['thefile']['name'], $_FILES['thefile']['type']); fclose($stream); $hv->putThings($file, $recordId); } $things = $hv->getThings('File', $recordId); foreach ($things as $thing) { print $thing->file->name . '<br>'; } print "<hr>"; ob_flush(); } catch (HVRawConnectorUserNotAuthenticatedException $e) { print "You're not authenticated! "; printAuthenticationLink(); } catch (HVRawConnectorAuthenticationExpiredException $e) { print "Your authentication expired! "; printAuthenticationLink(); } catch (Exception $e) { print $e->getMessage() . '<br>';
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); } $things = $hv->getThings('Weight Measurement', $recordId); foreach ($things as $thing) { print date(DATE_RFC850, $thing->getTimestamp('when')) . ': <b>'; print $thing->weight->value->kg . 'kg</b><br>'; } print "<hr>"; ob_flush(); } catch (HVRawConnectorUserNotAuthenticatedException $e) { print "You're not authenticated! "; printAuthenticationLink(); } catch (HVRawConnectorAuthenticationExpiredException $e) { print "Your authentication expired! "; printAuthenticationLink(); } catch (Exception $e) {