08-16-2016 08:05 - edited 08-16-2016 08:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

Jogger
2
0
0
08-16-2016 08:05 - edited 08-16-2016 08:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello gang
I try to access my data via the fitbit api, The Authorization portion work great, I can see my app in my user setting, I have a brand new access_token. But I cannot get any data from it always receive a 400 error.
Here my php code
$url = "https://api.fitbit.com/1/user/-/profile.json"; $auth_header = array("Authorization: Bearer " . $_SESSION['access_token']); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_HTTPHEADER, $auth_header); $result = curl_exec($curl); $results = json_decode($result, true);
$result is always
HTTP/1.1 400 Bad Request Server: cloudflare-nginx Date: Tue, 16 Aug 2016 14:56:45 GMT Content-Type: text/html Content-Length: 579 Connection: close
The weird thing even I I remove the header, I always got the 400 error without any error form the fitbit server.
Don't know why ????
Please help :O)
Regards
0 REPLIES 0
