Ok here is what I have so far, see what I am trying to do here ?

if((($conts = @file_get_contents($siteurl)) != FALSE) && (strpos(@file_get_contents("$siteurl"),"$recip")!==false))
    {
      echo "Link Is Found";
	} else {
      echo "Link Is NOT Found";
}

Now I need to add to the if statement still, If link is not within comment tags, Link is found, if a link or just the url is found with comment tags, then Link is not found.

But of course it needs to be added to the if statement.

The way you have it bpat1434 above would not work for me. I need it in the one if statement to work the way I have it going for me.

    if(preg_match("^<!--.*?".$siteurl.".*?--!>^si", $conts))
    {
      // It's inside a comment:
      echo 'Link is inside a comment, not available on the page';
    }
    else
    {
      echo 'Link is visible on the page';
    } 

    THat's it!! Now... integrate that to what you have.. it's not that hard!!

    if((($conts = @file_get_contents($siteurl)) != FALSE) && (strpos(@file_get_contents("$siteurl"),"$recip")!==false))
        {
          /**
           *
           * IT WOULD GO HERE!!!
           *
           */
          echo "Link Is Found";
    	} else {
          echo "Link Is NOT Found";
    }

    Show some effort next time!!

    if((($conts = @file_get_contents($siteurl)) != FALSE) && (strpos(@file_get_contents("$siteurl"),"$recip")!==false))
    {
      if(preg_match("^<!--.*?".$siteurl.".*?--!>^si", $conts))
      {
        // It's inside a comment:
        echo 'Link is NOT found.';
      }
      else
      {
        echo 'Link is FOUND';
      }
    } else {
      echo "Link Is NOT Found";
    }

      Sorry, I just didnt post everything I had tried, I am trying hard at this, just nothing worked the way I had tried.
      I did come close to what you had, just not close enough I guess.
      Will try what you have now.

      Thank You in case I have not said it.

        $conts = @file_get_contents($siteurl);
        if($conts != FALSE && (strpos($conts,$recip)!==false))
        {
          if(preg_match("^<!--.*?".$recip.".*?-->^si", $conts))
          {
            // It's inside a comment:
            echo 'Link is NOT found.';
          }
          else
          {
            echo 'Link is FOUND';
          }
        } else {
          echo "Link Is NOT Found";
        }

        Works for me... plus I optimized it just a bit... better to get the contents once rather than twice.... 😉

          this is still not working for me, regardless it finds it as being found

          if(preg_match("<!--.?".$recip.".?--!>si", $conts))

          I have gone thru the manual on preg_match and really cant find anything that resembles this issue either.

            If I use the last code you made, it finds all links as not found..

              Still using the code below, regardless it finds the link within the comment tags as Link is Found.. Which should show Link is NOT found.

              IT works for you and not me, I dont get it..

              if((($conts = @file_get_contents($siteurl)) != FALSE) && (strpos(@file_get_contents("$siteurl"),"$recip")!==false)) 
              { 
                if(preg_match("^<!--.*?".$recip.".*?--!>^si", $conts)) 
                { 
                  // It's inside a comment: 
                  echo 'Link is NOT found.'; 
                } 
                else 
                { 
                  echo 'Link is FOUND'; 
                } 
              } else { 
                echo "Link Is NOT Found"; 
              }
              

                1.) Are you sure you're searching the proper site?
                2.) Are you sure you didn't mess something up?

                Remember at the very top.... when you said it was there and I said it wasn't? Remember that? Did you mess up again and flip them around? Because it works for me, which should work for you.

                  What I am using is what I just showed you.
                  Your searching :

                  $siteurl for a link $recip correct ?

                    yes... but are you sure $siteurl is not inadvertantly mixed up so that you switched the two (like before)?

                      OK I am going to triple check I have everything correct.

                        Just for testing, I broke things down, and I tested it this way, and it still shows found, even though the link on the test page is within comment tags.

                        $siteurl="http://www.somesite.com/test.html";//looking on this page
                        $recip="http://www.mysite.com";//link I am looking for
                        
                        $conts = @file_get_contents($siteurl);
                        
                        if(preg_match("^<!--.*?".$recip.".*?--!>^si", $conts)) 
                          {
                          echo "not found";
                          } else {
                          echo "found";
                          }
                        
                        And On test.html page I have this..
                        <!--
                        <a href="http://www.mysite.com">test</a>
                        -->
                        

                        Am I not doing something right ?

                          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.

                            You said : actually.. replace this "--!>" with this: "-->" and all should work.

                            I am not using --!> at the end

                            I am using --> already
                            Here is what I am using :

                            <!--
                            <a href="http://www.mysite.com">test</a>
                            -->
                            
                            I also dont know how your checking the $siteurl without doing the
                            $conts = @file_get_contents($siteurl); 
                            Because you have it commented out..
                            
                            

                            So not sure what you mean now.. this should work and i know it should but like with the code I showed you I used for testing, it isnt working correctly.

                              no.. in the pattern... look in the pattern 😉

                                OK I know what you meant, take the ! out of here at end:
                                if(preg_match("<!--.?".$recip.".?--!>si", $conts))
                                Duh, I should have seen that it shouldnt have been there, made enough of those type of mistakes in my time.

                                  lol yeah... I think that was originally my mistake....

                                  so it works now?

                                    Nope, still finds link as found and it shouldnt
                                    Do me a favor and test the below code.

                                    Now it looks correct right ?
                                    Should work correct ?

                                    But it doesn't 🙁

                                    Now if I understand that code it is looking for <!-- and anything between that and the link after the link and then -->
                                    If it finds the link between the comment tags, it should print not found otherwise print found/
                                    Must be missing something somehow again..

                                    $siteurl="http://www.somesite.com/test.html";//looking on this page
                                    $recip="http://www.yoursite.com";//link I am looking for
                                    
                                    $conts = @file_get_contents($siteurl);
                                    
                                    if(preg_match("^<!--.*?".$recip.".*?-->^si", $conts)) 
                                      {
                                      echo "not found";
                                      } else {
                                      echo "found";
                                      }
                                    
                                      Write a Reply...