|
|
<?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;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|