Posted By

donkeykong on 04/22/10


Tagged

url remote String match stristr reciprocal


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

BrianCoyDesign
dantreacy


reciprocal link check


 / Published in: PHP
 

I couldn't easily find an example of how to verify if someone added my link to their site while they added their link to a directory of mine. After some research, I found out how to search for a string remotely. I have simplified the steps so that you get the gist of it and can modify the code as necessary.

  1. //// (PHP 4 >= 4.3.0, PHP 5)
  2.  
  3. $haystack = file_get_contents('http://lvgloves.com/testing/');
  4. $needle = '<a target="_blank" title="PHP and Flash Development" href="http://www.vectorflash.net">Vectorflash.net</a>';
  5.  
  6. if( stristr($haystack,$needle) != FALSE )
  7. {
  8. echo 'There is a match.';
  9. }

Report this snippet  

You need to login to post a comment.