twitter REST api v1.1的PHP转发语法不会从状态/ mentions_timeline数组转发

I'm in the process of setting up a test bot for retweeting tweets from my user statuses/mentions_timeline. I really need some help with grabbing the status ID from the array of mentions the script creates, so that I can use the statuses/retweet/:id resource to then retweet mentions

Here's the code, I won't include the Auth Tokens but they are there and I have no problems posting status updates.

$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$twitter->host = "https://api.twitter.com/1.1/";
$tweets = $twitter->get('statuses/mentions_timeline', ['count' => 200]);
$tweets1 = $twitter->get('users/show', ['count' => 170]);
$totalTweets[] = $tweets;
$page = 0;

$twitter->host = "https://api.twitter.com/1.1/";
for($count = 20; $count < 21; $count += 20) {
    $max = count($totalTweets[$page]) - 1;
    $tweets = $twitter->get('statuses/mentions_timeline', ['count' => 20, 'max_id' => $totalTweets[$page][$max]->id_str, 'screen_name' => 'UnkindRTs', 'include_rts' => false]);
    $totalTweets[] = $tweets;
    $page += 1;
        
}
$twitter->host = "https://api.twitter.com/1.1/";
$start = 1;
foreach($totalTweets as $page) {
    foreach($page as $key){
        echo $start . ':' . $key->text . '<br>';
        $postconn = $twitter->post('statuses/retweet/'.$key->text.id_str);
        $start++;
    }
}

</div>

figured it out thx for all the help though! XD

changed $postconn to

$postconn = $twitter->post('statuses/retweet/'.$key->id_str);

only had a small error xD