You can edit the files as per your requirement and add features like database connectivity.
2 files are used to write the script. One is a backlink checking class and the other one is an example file.
Code for PHP Class:
= 4.0.5*
---------------------------------------------------------------------*
EXAMPLE:** [ TO PARSE A STRING ]* $myLinks = &new LinkExtractor(); // create
a LinkExtractor Object* $myLinks->parseString( $myStringWithLinks ); // parse
a string* for( $a = 0, $b = count( $fetchLinks = $myLinks->getLinks() ); $a
< $b; $a++ ) {* echo $fetchLinks[$a]." ";* }** [ TO PARSE AN URL ( or if you want, a file ) ]* $myLinks = &new LinkExtractor(); // create a LinkExtractor Object* if( $myLinks->parseUrl( "http://www.techbongo.com/index.php"
) == true ) {* for( $a = 0, $b = count( $fetchLinks =
$myLinks->getLinks() ); $a < $b; $a++ ) {* echo $fetchLinks[$a]." ";* }* }** [ TO PARSE A FILE ]* $myLinks = &new LinkExtractor(); // create a LinkExtractor Object* if( $myLinks->parseFile( "myTextFile.txt" ) == true ) {* for( $a = 0, $b =
count( $fetchLinks = $myLinks->getLinks() ); $a < $b; $a++ ) {* echo $fetchLinks[$a]." ";* }* }* ---------------------------------------------------------------------class LinkExtractor { /* private Array variable: $linkReg [ contains pregs to parse links ]*/ var $linkReg = Array( "/(?i) /** * Public constructor. * Create a global
Array with no value, used for parsing * and an internal array with valid
pregs for links parsing. */ function LinkExtractor()
{ global
$__linkExtractor_linkRecipient; $__linkExtractor_linkRecipient =
Array(); }
/** * Private method, popolate internal Array with
preg matches * . * @Param String String to push into
internal array *
@Return nothing */ function
__manageLinkRecipient( $replacement ) { global
$__linkExtractor_linkRecipient; array_push(
$__linkExtractor_linkRecipient, htmlspecialchars( $replacement[2] )
); }
/** * Private method, call preg_replace_callback
function with string. * . * @Param String String to
parse * @Return nothing */ function __callBackCaller( $st )
{ preg_replace_callback( $this->linkReg, Array( &$this,
'__manageLinkRecipient' ), $st ); }
/** * Public method, read
remote page or file and parse them * . *
@Param String valid url address to parse *
@Return Boolean true if readed , false in other
cases */ function parseUrl( $url ) { if( @$fp = fopen(
$url, "r" ) ) { $st = ''; while( $text =
fread( $fp, 8192 ) ) { $st .=
$text; } fclose( $fp
); $this->__callBackCaller( $st ); return
true; } return false; } /** * Public
method, parse links in a file * . *
@Param String string to parse *
@Return nothing */ function parseFile( $st ) { return
$this->parseUrl( $st ); }
/** * Public method, parse links
in a string * . * @Param String string to parse *
@Return nothing */ function parseString( $st )
{ $this->__callBackCaller( $st ); } /** *
Public method, return an array with all found links * . *
@Param no no params need * @Return Array Array with all
links ( if there're ) */ function getLinks() { global
$__linkExtractor_linkRecipient; return
$__linkExtractor_linkRecipient; }}?>
Code For Example File:
"LinkExtractor.class.php" );
function linkExtractor( $what, $url = false )
{
// linkExtractor( $string_url_or_file [, true/false ] ) // true
if $string_or_url is an url or a file // false or anything if is a
string $myLinks = &new LinkExtractor(); if( $url == false )
{ $myLinks->parseString( $what ); } elseif( $url == true
) { if( $myLinks->parseUrl(
$what ) == false ) {
return false; } } return
$myLinks->getLinks();}
// EXAMPLE$url = "http://techbongo.com/resources/"; //
site to parse or check the reciprocal link
$testURL="http://techbongo.com/"; // the reciprocal url
to check
$arrayLinks = &linkExtractor( $url, true );
if( $arrayLinks
!= false ) { for( $a = 0, $b = count( $arrayLinks ); $a < $b; $a++ )
{ if($arrayLinks[$a]==$testURL) { echo
$arrayLinks[$a]."
"; //you can add your piece of code
here. if a reciprocal link is found, the link will be available via
$arrayLinks[$a] } }}?>
Hope this script helps you. You can download the files from the link given below:
Download Free Reciprocal Link Checker Script Using PHP
2 comments:
Thanks techbongo it seems great.. i think you know how google recaptha works.. so help me if i want to use this code as recaptha works in a form e.g in a email form. Got it? Thanks
this is such a nice and useful information for us...i appreciate urs word........Reciprocal Link Building Services
Post a Comment