简体   繁体   中英

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. 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. 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.

Thanks for your help

I regret to tell you that thujohn/twitter doesn't provide the function. You can read the source code as a reference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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