用于取消关注 instagram 取消关注者的 cURL 代码

Posted

技术标签:

【中文标题】用于取消关注 instagram 取消关注者的 cURL 代码【英文标题】:cURL code to unfollow instagram unfollowers 【发布时间】:2018-05-24 01:43:32 【问题描述】:
<?php

Class Instagram

public $username;
public $password;
private $guid;
private $my_uid;
private $userAgent = 'Instagram 6.21.2 android (19/4.4.2; 480dpi; 1152x1920; Meizu; MX4; mx4; mt6595; en_US)';
private $instaSignature ='25eace5393646842f0d0c3fb2ac7d3cfa15c052436ee86b5406a8433f54d24a5';
private $instagramUrl = 'https://i.instagram.com/api/v1/';



public function Login($username, $password) 
    $this->username = $username;
    $this->password = $password;    
    $this->guid = $this->GenerateGuid();
    $device_id = "android-" . $this->guid;  
    $data = '"device_id":"'.$device_id.'","guid":"'.$this->guid.'","username":"'. $this->username.'","password":"'.$this->password.'","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"';
    $sig = $this->GenerateSignature($data);
    $data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6';   
    $myid = $this->Request('accounts/login/', true, $data, false);  
    $decode = json_decode($myid[1], true); 
    $this->my_uid = $decode['logged_in_user']['pk'];
    print_r($this->my_uid); 
    return $myid;



public function PostFollow($user_id) 
    $device_id = "android-".$this->guid;
    $data = '"device_id":"'.$device_id.'","guid":"'. $this->guid .'","uid":"'.$this->my_uid.'","module_name":"feed_timeline","user_id":"'.$user_id.'","source_type":"5","filter_type":"0","extra":"","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"';   
    $sig = $this->GenerateSignature($data);
    $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6';
    return $this->Request('friendships/create/'.$user_id.'/', true, $new_data, true);   


public function PostUnFollow($user_id) 
    $device_id = "android-".$this->guid;
    $data = '"device_id":"'.$device_id.'","guid":"'. $this->guid .'","uid":"'.$this->my_uid.'","module_name":"feed_timeline","user_id":"'.$user_id.'","source_type":"5","filter_type":"0","extra":"","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"';   
    $sig = $this->GenerateSignature($data);
    $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6';
    return $this->Request('friendships/create/'.$user_id.'/', false, $new_data, true);  
 






?>

return $this-&gt;Request('friendships/create/'.$user_id.'/', false, $new_data, true) - 这是一个正确的 cURL 请求吗?

请参考postfollow函数(我的follow code)。

我希望 postUnfollow 功能会触发自动取消关注用户。

【问题讨论】:

什么意思这是一个正确的cURL请求吗?你没有试过检查-&gt;Request()方法的作用吗?如果它是一个外部库,只需调查它 我已经更新了我的问题...先生,您能复习一下吗?给我一些建议? 我正在开发一个 IG 个人资料管理应用程序,您可以关注/取消关注用户 【参考方案1】:

请检查我下面的代码并检查它是否工作

public function PostUnFollow($user_id,$username) 
    $device_id = "android-".$this->guid;
    $data = '"device_id":"'.$device_id.'","guid":"'. $this->guid .'","uid":"'.$this->my_uid.'","module_name":"feed_timeline","user_id":"'.$user_id.'","source_type":"5","filter_type":"0","extra":"","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"';   
    $sig = $this->GenerateSignature($data);
    $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=6';
    return $this->Request('friendships/destroy/'.$user_id.'/', true, $new_data, true,$username);  


【讨论】:

以上是关于用于取消关注 instagram 取消关注者的 cURL 代码的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Instagram API 获取我的关注者的关注者列表

在网站上显示 Instagram 关注者的数量

Instagram Graph API,获取关注者的关注者

如何从我的网站中删除 Instagram 权限?

是否可以从新的 instagram-graph-api 检索关注者列表?

Instagram API 访问限制