aspirine.org
Website utilities

(This email address is invisible to spambots)

Emailcode, PHP version : anti-spam email address encoder

encrypting email addresses so that spambots can't harvest them on web pages

last update : december 27th, 2007
Version française
IDDN
Certificat IDDN


This is the PHP version of the Emailcode online anti-spam email address encoder.
PHP developpers : this class allows you to quickly encode many email addresses on the fly, for instance an online address directory.
It generates <script> tags each containing one JavaScript-encoded email address.

  • encodes any link, including image links and any short html code.
  • variable, random, multi-layered encryption
  • your visitors will see the encoded addresses, whatever browser they use

See also :

Online Emailcode version in javascript with a form.
Simulate an email address harvester and test your web pages to see if your email addresses are exposed to extractors.
FTP & Mail password recovery : recover your lost passwords !

The original JavaScript is here
PHP adaptation mostly due to : Philippe
Version : 0.2
Requires : PHP ≥ 4.3
Bugs, comments etc : contact form

emailcode.class.php.zip

Usage (quick start) :

require 'emailcode.class.php';
$emailcode = new ClassEmailcode();
echo $emailcode->emailgetencode('mymail@myprovider.com');
echo $emailcode->emailgetencode('mymail@myprovider.com','Contactez-moi');
echo $emailcode->emailgetencode('mymail@mydomain.com','<img src="img.jpg" />');
echo $emailcode->htmlgetencode(
	'<input type="button" onclick="location='mailto:mymail@myprovider.com' />');

Options (usage details in the doc in the php file) :

  • mailto: link with a subject
  • link with a CSS class name
  • XHTML (default) or HTML <script> tag