jump to navigation

Protect Your Website’s Emails From Crawlers With PHP and Javascript December 3, 2011

Posted by Tournas Dimitrios in PHP.

A Web crawler or Spider is a computer program that browses the World Wide Web  (Internet ) in a methodical , automated manner or in an orderly fashion . This process is called Web crawling or spidering .  Search engines , use spidering  for indexing and storing all webpages so that they can provide up-to-date results to search queries . And you may ask  ” what is the point – that is my intention – to get indexed by search engines ” . Well the answer is : Email harvesting , it’s the process of obtaining lists of email addresses using various methods (like crawling )  for use in bulk email (spam ) . Usually spammers sell the lists of valid email addresses witch then are used as spam targets .  The following script is an “email protector ” , it hides all email from spiders . The concept is simple , crawlers can’t execute Javascript code , so only Javascript enabled browsers can parse the email string . Browsers by default have their Javascript engine enabled , so non-tech visitors won’t  notice this trick .

function php_split_js_make_email($phpemail) {
$pieces = explode("@", $phpemail);

echo '
<script type="text/javascript">
var a = "<a href=\'mailto:";
var b = "' . $pieces[0] . '";
var c = "' . $pieces[1] .'";
var d = "\' class=\'email\'>";
var e = "</a>";
<noscript>Please enable JavaScript to view emails</noscript>

Usage :
First include the above code in your web page before you plan on using it, then just write
<?php php_split_js_make_email("youremail@here.com") ; ?>

Source of this script .



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s