使用 oriceon laravel 5 oauth wrapper 修改 instagram 中的关系

modify relationship in instagram by using oriceon laravel 5 oauth wrapper

我正在使用 oriceon/oauth-5-laravel 连接 instagram。我通过了身份验证,并通过此请求获得了我的姓名和 ID

$result = json_decode($instagramService->request('users/self'), true); 现在我想用这个oriceon/oauth-5-laravel关注一个人。 我怎么能post通过使用这个来关注一个人的请求。

**注意:**不要引用 instagram 开发人员 page.I 将其重新引用为 lot.But 我无法为 ORICEON/laravel oauth wrapper 提出 post 请求。

提前帮助ME.TYSM

试试这个。将此方法复制到您的控制器并进行适当的路由。

public function followWithInstagram(Request $request)
    {
        $instagram_id='id of the user that you want to follow';
        $code = $request->get('code');
        $instagramService = \OAuth::consumer('Instagram');
        if ( ! is_null($code))
        {
            $state = isset($_GET['state']) ? $_GET['state'] : null;
            $instagramService->requestAccessToken($code, $state);
            $linkData = [
              'action' =>'follow',
                          ];
            $result =json_decode($instagramService->request('https://api.instagram.com/v1/users/'.$instagram_id.'/relationship','POST',$linkData),true);
            if(!$result){
                return ("Failed");
            }
            else {
                return ("SUCCESS");         
            }
        } else {
            $url = $instagramService->getAuthorizationUri();
            return redirect((string)$url);
        } 
    }