Skip to content

Instantly share code, notes, and snippets.

@MatthewJamesBoyle
Last active August 29, 2015 14:18
Show Gist options
  • Save MatthewJamesBoyle/32236eadfe942dbb09b2 to your computer and use it in GitHub Desktop.
Save MatthewJamesBoyle/32236eadfe942dbb09b2 to your computer and use it in GitHub Desktop.
basic php help
stdClass Object
(
[name] => RUN ON: 04/05/15 02:22 PM
[activityId] => 4038000000016924187710009732248116689150
[activityType] => RUN
[appId] => CONNECT
[timeZone] => +01:00
[timeZoneId] => GMT+01:00
[dstOffset] => 00:00
[startTimeUtc] => 2015-04-05T14:22:32+01:00
[status] => complete
[activeTime] => 0
[gps] => 1
[latitude] => 52.44516
[longitude] => -1.929284
[heartrate] =>
[deviceType] => SPORTWATCH
[tags] => stdClass Object
(
[SHOES] => stdClass Object
(
[name] => New running sho
[distance] => 524.12817977264
[activityCount] => 56
[percentage] => 19.377162629758
[retired] =>
)
)
[metrics] => stdClass Object
(
[duration] => 3219000
[calories] => 728
[fuel] => 2564
[steps] => 0
[distance] => 9.9973001480103
)
)
<?php
require_once 'NikePlusPHP.php';
function login($user,$pass){
$n = new NikePlusPHP($user, $pass);
return $n;
}
function flatten(array $array) {
$return = array();
array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; });
return $return;
}
function prettyPrint($a) {
echo '<pre>'.print_r($a,1).'</pre>';
}
$login = login("[email protected]",XXXXXXX);
$fuel = $login->activities(2); // this line got the info above from web service,
$test = flatten($fuel);
prettyPrint($test[0]);
$tags -> $test[0]->name;
var_dump($tags);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment