//this is used for title/description //this is used for title/description default: $obj->{$data->name} = (string) $data->value->string; } } //authenticate fitbit connection $fitbit = new FitBitPHP($conskey, $conssec); $fitbit->setOAuthDetails($user['FitBitToken'], $user['FitBitSecret']); __log("{$xml->params}->param[3]->value->struct->member[0]->value->string: " . $xml->params->param[3]->value->struct->member[0]->value->string); $body = $xml->params->param[3]->value->struct->member[1]->value->string; switch ($xml->params->param[3]->value->struct->member[0]->value->string) { case 'logBody': list($date, $weight, $fat, $bicep, $calf, $chest, $forearm, $hips, $neck, $thigh, $waist) = explode(",", $body); $date = dateconverter($date); $xml = $fitbit->logWeight($weight, $date); success('<string>' . $response->status_code . '</string>'); break; case 'logActivity': list($date, $activityId, $duration, $calories, $distance, $distanceUnit, $activityName) = explode(",", $body); $date = dateconverter($date); $xml = $fitbit->logActivity($date, $activityId, $duration, $calories, $distance, $distanceUnit, $activityName); success('<string>' . $response->status_code . '</string>'); break; case 'logFood': list($date, $foodId, $mealTypeId, $unitId, $amount, $foodName, $calories, $brandName, $nutrition) = explode(",", $body); $date = dateconverter($date); $xml = $fitbit->logFood($date, $foodId, $mealTypeId, $unitId, $amount, $foodName, $calories, $brandName, $nutrition); success('<string>' . $response->status_code . '</string>'); break; case 'logWater':
<?php $body = $_GET['body']; list($weight, $date) = explode(",", $body); require_once dirname(__FILE__) . '/load.php'; require 'fitbitphp.php'; $fitbit = new FitBitPHP($conskey, $conssec); $fitbit->setOAuthDetails('d3f4df585445526bf1ade9c8242bb8fd', '2c9313b5bff62c76a549fe3cd5e458b3'); //WONT WORK NEED TO FILL IN $xml = $fitbit->logWeight($weight, $date); print_r($xml);