如何取消关注注册我的应用程序推特的一些朋友

编程入门 行业动态 更新时间:2024-10-28 15:32:02
本文介绍了如何取消关注注册我的应用程序推特的一些朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我想关注/取消关注一些授权我的 Twitter 应用的朋友.

I want to follow/unfollow some friends who authorize my Twitter app.

例如:

用户使用我的推特应用程序登录,他想关注一些人

它是如何工作的?我在这里写了一些代码但不起作用,会话工作正常,用户登录但创建/友谊不起作用,为什么?

How does it work? I wrote some code here but not working, The session works fine, The user signs in but create/friendship not working, why?

<?php
session_start();
require_once('TwitterAPIExchange.php');
require_once('tmhOAuth.php');
require_once('tmhUtilities.php');
require_once('twitteroauth.php');
require 'twconfig.php';
echo $_SESSION['oauth_token'];
echo "<br />";
echo $_SESSION['oauth_token_secret'];

$twitteroauth = new TwitterOAuth($consumerKey, $consumerKeySecret, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret'] );
$twitteroauth->post('friendships/create', array('screen_name' => 'savanpaun'));
?>

简单地说,我希望人们直接在我的应用程序中使用注册来关注/取消关注朋友.

Simply put, I want people follow/unfollow friends using signup in my application directly.

推荐答案

我复制粘贴你的例子并在最后一行替换为 destroy 命令

I copy paste you example and replace in the last line with destroy command

<?php
session_start();
require_once('TwitterAPIExchange.php');
require_once('tmhOAuth.php');
require_once('tmhUtilities.php');
require_once('twitteroauth.php');
require 'twconfig.php';
echo $_SESSION['oauth_token'];
echo "<br />";
echo $_SESSION['oauth_token_secret'];

$twitteroauth = new TwitterOAuth($consumerKey, $consumerKeySecret, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret'] );
$twitteroauth->post('friendships/destroy', array('user_id' => 'iduser'));
?>

这一行

$twitteroauth->post('friendships/destroy', array('user_id' => 'iduser'));

希望对你有所帮助

最好

这篇关于如何取消关注注册我的应用程序推特的一些朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 15:28:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1192041.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   朋友

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!