Checking for site reciprocal link

Eldeste1965

New Member
I'm trying to make a script that will load a desired URL (as entered by user) and check if that page links back to my domain before their domain is published on my site. I'm not very experienced with regular expressions and this is what I have so far:\[code\]$loaded = file_get_contents('http://localhost/small_script/page.php');// $loaded will be equal to the users site they have submitted$current_site = 'site2.com';// $current_site is the domain of my site, this the the URL that must be found in target site$matches = Array();$find = preg_match_all('/<a(.*?)href=http://stackoverflow.com/questions/3782969/[/'"](.*?)[\'"](.*?)\b[^>]*>(.*?)<\/a>/i', $loaded, $matches);$c = count($matches[0]);$z = 0;while($z<$c){ $full_link = $matches[0][$z]; $href = http://stackoverflow.com/questions/3782969/$matches[2][$z]; $z++; $check = strpos($href,$current_site); if($check === false) { }else{ // The link cannot have the"no follow" tag, this is to check if it does and if so, return a specific error $pos = strpos($full_link,'no follow'); if($pos === false) { echo $href; } else { //echo "rel=no follow FOUND"; } }}\[/code\]As you can see, it's pretty messy and I'm entirely sure where it's headed. I was hoping someone could give me a small, fast and concise script that would do exactly what I've attempted.[*]Load specified URL as entered by user[*]Check if specified URL links back to my site (if not, return error code #1)[*]If link is there, check for 'no follow', if found return error code #2[*]If everything is OK, set a variable to true, so I can continue with other functions (like displaying their link on my page)
 
Back
Top