mirror of
https://github.com/Eleirbag89/MastodonBotPHP
synced 2025-01-06 18:06:42 +01:00
812a450306
Created a new example script to show how to simply post a plain text status update to a Mastodon account.
23 lines
742 B
PHP
23 lines
742 B
PHP
<?php
|
|
|
|
include_once 'Mastodon.php';
|
|
|
|
$token = ''; // Token of your Mastodon bot account
|
|
$baseURL = 'https://botsin.space'; // URL of your instance (Do not include '/' at the end.)
|
|
$privacy = 'private'; // "Direct" means sending message as a private message. The four tiers of privacy for toots are public , unlisted, private, and direct
|
|
$language = 'en'; // en for English, zh for Chinese, de for German etc.
|
|
$statusText = 'This is a status';
|
|
|
|
$statusData = array(
|
|
'status' => $statusText,
|
|
'privacy' => $privacy,
|
|
'language' => $language
|
|
);
|
|
|
|
$mastodon = new MastodonAPI($token, $baseURL);
|
|
$result = $mastodon->postStatus($statusData);
|
|
|
|
// Activate the next line if you want to print the result of the query
|
|
//var_dump($result);
|
|
?>
|