I want to extract a href attribute but this attributes especially has mailto function. and i want to do this not just for one link but all links belongs to main webpage.
I tried this:
<?php
$url = "https://www.omurcanozcan.com";
$html = file_get_contents( $url);
libxml_use_internal_errors( true);
$doc = new DOMDocument;
$doc->loadHTML( $html);
$xpath = new DOMXpath( $doc);
$node = $xpath->query( "//a[@href='mailto:']")->item(0);
echo $node->textContent; // This will print **GET THIS TEXT**
?>
I expect for instance a code is
<a href='mailto:omurcan@omurcanozcan.com'>omurcan@omurcanozcan.com</a>
I want to echo
<p>omurcan@omurcanozcan.com</p>