1

I'm writing a web crawler tool to collect the email addresses. After downloading the HTML content and parsing it using DomCrawler, I get this node value:

<!--
document.write("<a rel='nofollow' href='mailto:&#104;&#105;&#101;&#117;&#98;&#100;&#115;&#104;&#97;&#112;&#112;&#121;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;'>&#104;&#105;&#101;&#117;&#98;&#100;&#115;&#104;&#97;&#112;&#112;&#121;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;");
//-->This email address has been protected. You need to enable JavaScript to view the content.

How could I decode it?

1 Answer 1

2

The value is just html encoded values of the characters from the original string so in PHP you can use html_entity_decode to get the original text.

$returnValue = html_entity_decode('mailto:&#104;&#105;&#101;&#117;&#98;&#100;&#115;&#104;&#97;&#112;&#112;&#121;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;'>&#104;&#105;&#101;&#117;&#98;&#100;&#115;&#104;&#97;&#112;&#112;&#121;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;', ENT_COMPAT);

See: https://www.functions-online.com/html_entity_decode.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.