DEV Community

Cover image for RSS to X (Twitter) PHP Bot
Ozan Yıldırım
Ozan Yıldırım

Posted on

RSS to X (Twitter) PHP Bot

RSS to X (Twitter) PHP Bot. Most sites already broadcast updates via RSS, but posting to X (Twitter) is still a manual chore. In this mini build, we ship a self-hosted PHP bot that reads your RSS feed and publishes new items to X using the official API—no plugins, no monthly fees. It’s the sibling of our Instagram bot: simple cURL requests, a little formatting, and a cron job.

What it does

Reads RSS and picks the latest items (with a per-run limit).

Builds the post text (title + link, truncated to fit X limits).

Calls X API with a bearer token to publish.

De-dupes items (so you don’t double-post) and avoids overlapping runs.

Why this approach

Total control (self-hosted), zero subscriptions.

Works with any stack (plain PHP + cURL).

Easy to extend: hashtags, UTM links, schedules, language filters…

What you’ll need (no secrets shown)
An X developer account and a Bearer token for posting (app in write mode).

A public RSS feed URL.

PHP with cURL.

(Optional) a tiny file/DB store to remember posted GUIDs.

Posting flow (high-level):

GET RSS → parse items

For each unseen item: build status = "{title} {short_link}"

POST to X’s API with Authorization: Bearer …

Store GUID hash to avoid duplicatesRSS to X (Twitter) PHP Bot. Most sites already broadcast updates via RSS, but posting to X (Twitter) is still a manual chore. In this mini build, we ship a self-hosted PHP bot that reads your RSS feed and publishes new items to X using the official API—no plugins, no monthly fees. It’s the sibling of our Instagram bot: simple cURL requests, a little formatting, and a cron job.

What it does

Reads RSS and picks the latest items (with a per-run limit).

Builds the post text (title + link, truncated to fit X limits).

Calls X API with a bearer token to publish.

De-dupes items (so you don’t double-post) and avoids overlapping runs.

Why this approach

Total control (self-hosted), zero subscriptions.

Works with any stack (plain PHP + cURL).

Easy to extend: hashtags, UTM links, schedules, language filters…

What you’ll need (no secrets shown)
An X developer account and a Bearer token for posting (app in write mode).

A public RSS feed URL.

PHP with cURL.

(Optional) a tiny file/DB store to remember posted GUIDs.

Posting flow (high-level):

GET RSS → parse items

For each unseen item: build status = "{title} {short_link}"

POST to X’s API with Authorization: Bearer …

Store GUID hash to avoid duplicates

Code & Source : https://minicoursey.com/rss-to-x-twitter-php-bot

Top comments (0)