简体   繁体   English

如何使用带有 Laravel PHP 的 Thujohn\\Twitter 包删除特定推文

[英]How to delete a specific tweet using Thujohn\Twitter package with Laravel PHP

I am creating an application where the users connect their twitter account - store their access and secret token in DB.我正在创建一个应用程序,用户可以在其中连接他们的 twitter 帐户 - 将他们的访问和秘密令牌存储在数据库中。 They are then presented with their tweets and can delete them.然后他们会看到他们的推文,并且可以删除它们。

I have used the Thujohn Twitter Package to get the user's tweets using their tokens.我已经使用 Thujohn Twitter Package 使用他们的令牌获取用户的推文。 https://github.com/thujohn/twitter https://github.com/thujohn/twitter

However, I cannot use this package to delete a specific tweet.但是,我无法使用此包删除特定推文。

My question is - How can I use this package to delete a tweet?我的问题是 - 如何使用此包删除推文?

My code in my controller to delete a tweet is as such我在控制器中删除推文的代码是这样的

function deleteTweet () {
    $user = Auth::user();
    $accessToken = $user->twittertoken;
    $accessSecret = $user->twittersecret;

    $request_token = [
        'token'  => $accessToken,
        'secret' => $accessSecret,
    ];

    Twitter::reconfig($request_token);
    $tweet_id = '777869567897038848';
    $tweets = Twitter::post("status/destroy/$tweet_id.json");

    var_dump($tweets);
}

I have filled the tweet id manually.我已经手动填写了推文ID。

Thanks for your help谢谢你的帮助

I regret to tell you that thujohn/twitter doesn't provide the function.我很遗憾地告诉您thujohn/twitter不提供该功能。 You can read the source code as a reference.您可以阅读源代码作为参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM