On Thu, Sep 9, 2010 at 9:52 AM, Jack <jacklistm...@gmail.com> wrote: > > Hello All, > > > I have some code which converts to some html to ascii characters. This > basically obfuscates the html code, but shows it correctly on an page. > > > I am trying to show the results of the obfuscation ( works correctly because > it displays the html value ), but I want to then show the obfuscated html > code so they can copy it. > > An example is I want to show them this below: > > <a > href="mailto:your > 0;email.addre� > 0115;s?subject=&cc=&bcc=&body=" style="" class="" > id="">your@email� > 46;address</a> > > > > Which was created by the code, but I apparently can't seem to echo it and > get it to display like above.. It converts it to html no matter what I do.
This should do it: <?php $var = '<a href="mailto:email@example.com?subject=&cc=&bcc=&body=" style="" class="" id="">firstname.lastname@example.org</a>'; echo htmlspecialchars($var); ?> The obfuscation doesn't buy you much, though. <?php var_dump(html_entity_decode($var, ENT_QUOTES, 'utf-8')); ?> string(106) "<a href="mailto:y...@email.address?subject=&cc=&bcc=&body=" style="" class="" id="">y...@email.address</a>" The only people for whom the value will be obscure will be the humans who actually try to read the HTML source code itself. Neither web browsers nor harvesting scripts won't have any trouble reading it. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php