Hello everyone !
I’m very new in twitteroauth and I try to tweet something, and then add this tweet to a collection. According to the documentation, I only need collection and tweet id. But I don’t know the good syntaxe to do it. That say {“error”:“Missing required parameter ‘id’.”}
I try this :
<?php
require_once '../vendor/abraham/twitteroauth/autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
session_start();
$connection = new TwitterOAuth('xxxxxxxxxxxxx', 'xxxxxxxxxxxx', $_SESSION['access_oauth_token'], $_SESSION['access_oauth_token_secret']);
//$usr = $connection->get("account/verify_credentials");
$media = $connection->upload("media/upload", ['media' => $_SESSION['base64']]);
$tweetName = "@KrankerApfel";
$siteURL = "https://kakisoko.000webhostapp.com/";
$tweet = [
'status' => $_POST['textarea']." via ".$tweetName." ".$siteURL ,
'media_ids' => implode(',', [$media->media_id_string]),
];
$result = $connection->post("statuses/update", $tweet);
$add = $connection ->post("collections/entries/add",['id'=>'10101010'], ['tweet_id' => $result->id]); // 10101010 is replace by real collection id
echo json_encode($add);
//header('Location: https://kakisoko.000webhostapp.com/index.php');
?>