Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fetch data from fitbit using fitbitphp or python fitbit

I am bought a fitbit device and I am trying to understand how is it possible to fetch data (for example steps and heart rate). I have create a dev and generate a token id and a secret. Is there any tutorial in how to use those crendentials in order to get data? How can I fetch data real time? Is there a way to do so or there are limitations? Moreover I got the following php wrapper fitbitphp. I am trying to run the basic code in order to get access to my fitbit app. I am using the following code:

 

<?php
require 'fitbitphp.php';
$fitbit = new FitBitPHP('........', '......');
$fitbit->initSession('http://example.com/callback.php');
$xml = $fitbit->getProfile();
print_r($xml);

However I am receiving the following messages:

 

( ! ) Fatal error: Uncaught exception 'OAuthException' with message 'making the request failed (Peer certificate cannot be authenticated with given CA certificates)' in C:\wamp\www\fitbitphp-master\fitbitphp.php on line 184
( ! ) OAuthException: making the request failed (Peer certificate cannot be authenticated with given CA certificates) in C:\wamp\www\fitbitphp-master\fitbitphp.php on line 184

Any idea about my problems?

Edit: I tried to user python fitbit lib. My python code is the following:

 

import fitbit
unauth_client = fitbit.Fitbit('...', '...')
unauth_client.food_units()

I got the following message: 

raise HTTPUnauthorized(response)
 fitbit.exceptions.HTTPUnauthorized: oauth_acceptable_timestamps=1439885193-1439885793

Any idea about both issues? Basically what should I add in authd_client = fitbit.Fitbit()? What is exactly USER_KEY and USER_SECRET?

Best Answer
0 Votes
1 REPLY 1

It seems that you have some problem with SSL certificate. For fixing this in PHP maybe this could help http://stackoverflow.com/questions/521418/reading-ssl-page-with-curl-php

Best Answer
0 Votes