Obfuscate Email address with PHP from Spambots
I was using javascript to obfuscate my email addresses from spambots but it didn’t validate as strict XHTML under W3C so I was searching for a PHP solution. Here is a super easy solution which validates as XHTML Strict.
< ?php // store the email address in a string variable $email= "webmaster@example.com"; // get the length of the email address $length = strlen($email); // work your way through each //character of the email address for ($i = 0; $i < $length; $i++) // get the deicmal ASCII value of the character $obfuscatedEmail .= "&#" . ord($email[$i]) . ";"; ?>
I have to give where credit is due so thanks to Aaron Toponce for this Obfuscate email PHP style.
Note: I did change the last line since I was receiving an error “reference not terminated by REFC delimiter” even though Aaron original code was validating as Strict XHTML. The code is dated back Nov 2005 but still functions. =)
BlinkBits | BlinkList | del.icio.us | Digg it | Earthlink | FeedMarker | Flog this! | Furl | iFeedReaders | ma.gnolia | Maple.nu | Netvouz | Netscape | Newsvine | Onlywire | RawSugar | reddit | Scuttle | Shadows | Simpy | Spurl | StumbleUpon | tagtooga | TalkDigger | Wink | Yahoo MyWeb | Diigo |