Php 斯特拉瓦Api问题

Php 斯特拉瓦Api问题,php,strava,Php,Strava,我正在使用这个作曲家软件包 OAUTH工作正常,它会生成带有访问令牌和用户id等的JSON 但每当我尝试使用其他函数时,它都会返回404NotFound 输出如下: {"token_type":"Bearer","access_token":"077058e0c800881c72a4b10a04a520d5898d4e3e","athlete":{"id":35670467,"username":"amir_do","resource_state":2,"firstname":"Amir","l

我正在使用这个作曲家软件包

OAUTH工作正常,它会生成带有访问令牌和用户id等的JSON

但每当我尝试使用其他函数时,它都会返回404NotFound

输出如下:

{"token_type":"Bearer","access_token":"077058e0c800881c72a4b10a04a520d5898d4e3e","athlete":{"id":35670467,"username":"amir_do","resource_state":2,"firstname":"Amir","lastname":"Do","city":null,"state":null,"country":null,"sex":"M","premium":false,"summit":false,"created_at":"2018-10-13T13:55:41Z","updated_at":"2018-10-13T13:56:25Z","badge_type_id":0,"profile_medium":"https://lh5.googleusercontent.com/-ku6v9lKNgYY/AAAAAAAAAAI/AAAAAAAAAAA/ABtNlbASj8KhClhwnVYVqRrEG2oiYzWPbA/mo/photo.jpg","profile":"https://lh5.googleusercontent.com/-ku6v9lKNgYY/AAAAAAAAAAI/AAAAAAAAAAA/ABtNlbASj8KhClhwnVYVqRrEG2oiYzWPbA/mo/photo.jpg","friend":null,"follower":null,"email":"goncalomaia97@gmail.com"}}
35670467


Client error: `GET https://www.strava.com/api/athletes/35670467/stats?access_token=077058e0c800881c72a4b10a04a520d5898d4e3e` resulted in a `404 Not Found` response: {"message":"Record Not Found","errors":[{"resource":"resource","field":"path","code":"invalid"}]}
这是我当前的callback.php页面代码:

<?php 
include 'vendor/autoload.php';
use Strava\API\Client;
use Strava\API\Exception;
use Strava\API\Service\REST;
session_start();
$client = new GuzzleHttp\Client();
global $connect;

require_once("configs/database.php");
$connect = new mysqli($config['database']['host'],$config['database']['user'],$config['database']['pass'],$config['database']['db']); 

$code = $_GET['code'];
$state = $_GET['state'];
$scope = $_GET['scope'];

$user = $_SESSION['username'];
$check = $connect->query("SELECT * FROM users WHERE email = '$user'");
$fetch = $check->fetch_array(MYSQLI_ASSOC);

$apix = $fetch['api'];
$api_secretx = $fetch['api_secret'];

$client = new GuzzleHttp\Client();
$data   = [
    "client_id"    => $apix,
    "client_secret" => $api_secretx,
    "code" => $code
];

$result = $client->post('https://www.strava.com/oauth/token', ['json' => $data]);


print "<pre>";
print_r( $result->getBody()->getContents() );
print "</pre>";


$bodyb = $result->getBody();
$varx = json_decode((string) $bodyb, true);

$token = $varx['access_token'];
$id = $varx['athlete']['id'];


$_SESSION['token'] = $token;

printf($id);
try {
// REST adapter (We use `Guzzle` in this project)
$adapter = new \GuzzleHttp\Client(['base_uri' => 'https://www.strava.com/api/v3']);
// Service to use (Service\Stub is also available for test purposes)
$service = new \Strava\API\Service\REST($token, $adapter);

// Receive the athlete!
$client = new Client($service);
$athlete = $client->getAthleteStats($id);
print_r($athlete);

} catch(Exception $e) {
    print $e->getMessage();
}

将其更改为此(应为尾随):

$adapter = new \GuzzleHttp\Client(['base_uri' => 'https://www.strava.com/api/v3']);
$adapter = new \GuzzleHttp\Client(['base_uri' => 'https://www.strava.com/api/v3/']);