mirror of
https://github.com/Eleirbag89/MastodonBotPHP
synced 2025-02-02 14:26:43 +01:00
Simple example for posting a status update
Created a new example script to show how to simply post a plain text status update to a Mastodon account.
This commit is contained in:
parent
cf70522a80
commit
812a450306
22
examples/status_bot.php
Normal file
22
examples/status_bot.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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);
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user