Protect your WordPress blog from the backup copies on the telegraph

Prevent articles from being copied by @chotamreaderbot and @corsabot bots

Who doesn’t love @chotamreaderbot and @corsabot? The two fantastic bots on Telegram that thanks to the excuse of creating instant views of the articles, thanks to a copy on telegra.ph, allows the web savvy to use it to be able to read blog articles without giving the same blog numbers on visits.

I understand the thought of those who hate all kinds of anti-tracking scripts, but I also understand those who have a blog and want to defend themselves from this practice.

The solution is as simple as it is immediate.

Just insert the following code inside the functions.php file of our theme

// by Francesco for www.selectallfromdual.com
add_action('parse_query','fuck_bot_telegraph');
function fuck_bot_telegraph() {
	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
		//check ip from share internet
		$ip = $_SERVER['HTTP_CLIENT_IP'];
	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
		//to check ip is pass from proxy
		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
	} else {
		$ip = $_SERVER['REMOTE_ADDR'];
	}

	$json_string = file_get_contents('https://www.selectallfromdual.com/services/chotamreaderbot/getiplist');

	$json = json_decode($json_string, true);


	if (in_array($ip,$json['ips'])) {
		wp_redirect("https://it.wikipedia.org/wiki/Diritto_d'autore");
	} 
}

that apart from the goliardia of the descriptions used, allows you to redirect the services used by the two bots on other sources that are not our blog, in order to avoid being copied.

How does it work

The function downloads the IPs identified as coming from the two bots via a services, so that it will not even be necessary to update it as we will do it for you.

I hope I have been helpful in writing a useful WordPress plugin.

We periodically check the functioning of the links in our articles. If you notice any links that do not work, please let us know in the comments. If you enjoyed the article consider supporting the blog with a small donation. Thank you. Patreon / Ko-fi / Liberapay / Paypal

Leave a Reply

Your email address will not be published. Required fields are marked *