using this string:
<a href="www.bpatterson.net">New Link</a><br />
<!-- <a href="www.patternet.com">Commented Link</a> -->
<!--
<a href="www.roundcubeforum.net">another Commented Link</a>
-->
with this PHP code:
$recips=array('www.bpatterson.net','www.patternet.com','www.roundcubeforum.net');
//$conts = @file_get_contents($siteurl);
$conts = $siteurl;
foreach($recips as $recip)
{
echo '<b>'.$recip.':</b> ';
if($conts != FALSE && (strpos($conts,$recip)!==false))
{
if(preg_match("^<!--.*?".$recip.".*?-->^si", $conts))
{
// It's inside a comment:
echo 'Link is commented out.';
}
else
{
echo 'Link is FOUND.';
}
} else {
echo "Link Is NOT Found.";
}
echo '<br>';
}
I get this output:
www.bpatterson.net: Link is FOUND.
www.patternet.com: Link is commented out.
www.roundcubeforum.net: Link is commented out.
Which is as expected.... nto sure where you're going wrong....
actually.. replace this "--!>" with this: "-->" and all should work.