Obfuscating a String


You want to prevent spam-bots from sniffing a string on your web page.


Use the HTML::obfuscate() method.

This method randomly replaces characters in a string with HTML entities. This allows the string to appear correctly in web pages, but many screen scrapers will see the string as garbage.

This is used most frequently for email addresses. For example.

{{-- Blade template --}}
{{ HTML::obfuscate('me@gmail.com') }}

The above would output something similar to below.

me@gmail. \


This is used by both HTML::email() and HTML::mailto().

Those methods will obfuscate emails. See Obfuscating an Email Address and Generating a HTML Link to an Email Address.

comments powered by Disqus