202312 - Twitter API v2

This commit is contained in:
2023-12-27 15:40:10 +01:00
parent a980fbe8f9
commit 0bef7e1532
46 changed files with 2252 additions and 179 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
require '../../generique/inc/twifer.php';
use Twifer\API;
class twitter
{
public static function tweet($message, $media='')
{
$twitter = new API(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$filename = '0000000000000000000034a2ed514ecda92b8b88593b0bc8e6ffffc978721c25.png';
$media_id='1739965196775346176';
if (($media != NULL)&&($media != '')){
$img = $twitter->request('POST', 'media/upload', ['media' => $media]);
$media_id=$img['media_id'];
}
$postfields = "{\"text\":\"$message\", \"media\": {\"media_ids\": [\"$media_id\"]}}";
$res = $twitter->request('POST', '/2/tweets', $postfields);
return TRUE;
}
public static function thanksRetweet()
{
return TRUE;
}
public static function thanksFollowers()
{
return TRUE;
}
}
?>