This material was created with the help of AI and may contain errors. The included script has been tested for production and is provided as-is.
Automatic IP Switching#
PrivateFlare offers automatic IP address replacement when a node becomes unavailable — a key failover feature for traffic arbitrage infrastructure.
Why Is This Needed?#
A typical scenario: websites stop responding due to blocked or unavailable nodes, leading to traffic loss until DNS records are manually updated. This automation eliminates the need for manual intervention.
How the Automation Works#
The PHP script performs the following steps:
- Monitors node availability via a specified URL (GET/POST with JSON payload)
- Marks the node as dead if no valid response (200, 301, 302) is received within 5 seconds
- Queries current A records via the Cloudflare API
- Switches to the next IP from the configured pool (sequential rotation)
- Updates the DNS record via the Cloudflare API
- Sends a notification to Telegram
What Does This Provide?#
- Minimal downtime thanks to fast IP switching
- Easy scaling across multiple nodes
- Fully autonomous operation without manual DNS updates
- Real-time Telegram notifications
How to Set Up#
Requirements:
- PHP >= 7.4
- Configure: domain, hostname, Cloudflare credentials, IP pool, Telegram bot token, and chat ID
Getting Your Telegram Chat ID#
Method 1: Message @userinfobot — it will immediately show your ID.
Method 2: Send a message to your bot, then open:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatesFind the "id" field in the JSON response.
How to Run the Script?#
Via Cron (every 2 minutes):
*/2 * * * * php /path/to/checker.phpVia HTTP: Host it on a web server and call it through monitoring systems, CI/CD pipelines, or curl:
curl https://yourhost.com/tools/checker.php