Backlink Script NEEDED!

Discussion in 'PHP' started by worldman, Jun 19, 2009.

  1. #1
    I need a script that allows me to enter multiple URL's and check whether there is a backlink to my site as well as if its dofollow or nofollow.

    I'm sure there is a script out there to do this. Could someone please help me. Thanks.
     
    worldman, Jun 19, 2009 IP
  2. aquasonic

    aquasonic Well-Known Member

    Messages:
    90
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    115
    #2
    aquasonic, Jun 19, 2009 IP
    worldman likes this.
  3. bluebenz

    bluebenz Well-Known Member

    Messages:
    876
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    138
    #3
    bluebenz, Jun 19, 2009 IP
    worldman likes this.
  4. mehmetm

    mehmetm Well-Known Member

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #4
    hi, you can use the script below.

    
    <?php
    function check_back_link($remote_url, $your_link) {
        $match_pattern = preg_quote(rtrim($your_link, "/"), "/");
        $found = false;
        if ($handle = @fopen($remote_url, "r")) {
            while (!feof($handle)) {
                $part = fread($handle, 1024);
    						
    	    $pattern = "/<a(.*)href=[\"']".$match_pattern."(\/?)[\"'](.*)rel=[\"']([A-Za-z- ]+)[\"'](.*)>(.*)<\/a>/";
    			
                if (preg_match($pattern, $part, $result)) {
                    $found = true;
                    break;
                }
            } 
            fclose($handle);
        }
    	$return['found'] = $found;
    	$return['result'] = $result;
        return $return;
    }
    
    
    // EXAMPLE USAGE:
    
    $return = check_back_link("http://www.anothersite.com", "http://www.yoursite.com");
    
    if($return['found'] == TRUE):
    
    	echo '<p><strong>Status:</strong> Link exists</p>';
    	echo '<p><strong>Rel:</strong> '.$return['result'][4].'</p>';
    	
    else:
    
    	echo 'link doesn\'t exist';
    	
    endif;	
    
    ?>
    
    PHP:
     
    mehmetm, Jun 19, 2009 IP
  5. juust

    juust Peon

    Messages:
    214
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    juust, Jun 19, 2009 IP