-
-
Save ssherar/e4491648325e601afa20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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]); | |
echo($test[0]->name ); // RUN ON: 04/05/15 02:22 PM | |
echo($test[0]->tags->SHOES->name); // New running sho | |
var_dump($tags); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment