Strava API的问题

时间:2019-02-17 18:30:58

标签: php

我正在尝试使用cURL获取我的活动列表,我可以很好地获取我的俱乐部列表。似乎无法弄清楚我在做什么错

使用请求时出现问题。 $ http GET“ https://www.strava.com/api/v3/activities/ {id}?include_all_efforts =”“授权:承载[[token]]”

I cam getting an error 



string(95) "{"message":"Record Not Found","errors": 
[{"resource":"Activity","field":"id","code":"invalid"}]}"


**I have tried the following** 


    $num = "2149016538";
    $int = (int)$num;
   // $url = 'https://www.strava.com/api/v3/athlete/clubs';
    $url = 'https://www.strava.com/api/v3/activities/{'.$int.'}?include_all_efforts=true';

**No success**

**I have also tried this** 

       $num = "2149016538";
    $int = (int)$num;
   // $url = 'https://www.strava.com/api/v3/athlete/clubs';
     $url = 'https://www.strava.com/api/v3/activities/?id='.$int.'?include_all_efforts=true';



    $authorization = "Authorization: Bearer 23232323";
    $num = "2149016538";
    $int = (int)$num;
   // $url = 'https://www.strava.com/api/v3/athlete/clubs';
    $url = 'https://www.strava.com/api/v3/activities/{'.$int.'}?include_all_efforts=true';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
    // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

   // curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);

    var_dump($result);
    curl_close($ch);
    json_decode($result);

0 个答案:

没有答案