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...