Instagramm API PHP 关注用户 [英] Instagramm API PHP Follow User

查看:27
本文介绍了Instagramm API PHP 关注用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我尝试在网站中实现 Instagramm API.哪个能够获得访问令牌,然后关注用户.

at the Moment i try to implent the Instagramm API in a Website. Which is able to get Access Token and then follow a User.

我在 Google 上搜索过,但找不到有用的 PHP 代码示例?

I searched Google but i wasnt able to find a usefull code Example for PHP ?

我唯一发现的是这个https://github.com/cosenary/Instagram-PHP-API


现在我在这里编码了这个


Now i coded this one here

   error_reporting(E_ALL);
ini_set("display_errors", 1);
require 'inc/Instagram.php';
require 'inc/InstagramException.php';

use MetzWeb\Instagram\Instagram;

$instagram = new Instagram(array(
    'apiKey'      => 'APIKEY',
    'apiSecret'   => 'SECRET',
    'apiCallback' => 'CALLBACK'
));


if (isset($_GET['code'])) {
// grab OAuth callback code
$code = $_GET['code'];
$data = $instagram->getOAuthToken($code);

echo 'Your username is: ' . $data->user->username;  

$token= $data->access_token;
$instagram->setAccessToken($token);
echo $instagram->getAccessToken();
try {

$instagram->modifyRelationship('follow', 1399448929);

} catch (Exception $e) {
    echo 'Exception abgefangen: ',  $e->getMessage(), "\n";
}

}else {

        $urli= $instagram->getLoginUrl(array(
    'basic',
    'relationships',
    'likes'
));


    echo "<a href=".$urli.">Login with Instagram</a>";

}

但是它不起作用...没有错误消息或其他内容,但它没有跟随用户.

But it isnt working... There is no Error Message or something else but it isnt following the User.

那么现在我的问题:

有人知道为什么吗?...或者有没有人知道让这个工作的正确方法?

Does someone know why ? ... Or does anyone know the right way to get this working ?

请提供链接和代码示例.

Please with Links and Code Examples.

那是葡萄
谢谢!!!

That Would be Grape
Thanks!!!

推荐答案

您可以关注 instagramm API.我用它来登录 Instagram 及其对我的工作

You can follow the URL for instagramm API. I use this for instagram login and its work for me

但您也可以检查是否关注用户 &关系,但我认为它也适用于你.

but you can also check for follow a User & Relationship but I think it will work for you as well.

这篇关于Instagramm API PHP 关注用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆