Thursday, July 30, 2009

Free Reciprocal Link Checker Script in PHP

This time, we're publishing a short simple code for backlink checking. Webmasters, who are doing lot of link exchange via forum, chats, mails etc. often need a reciprocal link checker script. Because, often one of the link exchanging party removes other's backlink from his website. Now, it's really hard for you to test each and every reciprocal link for your website. This PHP script will make your work easier.

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( ""
) == 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
// EXAMPLE$url = ""; //
site to parse or check the reciprocal link
$testURL=""; // 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
"; //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

Free Reciprocal Link Checker Script Using PHP Simple Backlink Checker Script PHP Code To Check Reciprocal Link Link Exchange Script

Friday, July 10, 2009

Tricks For Better Adsense Targeting and High CTR

What is AdSense?
AdSense ads are ads displayed on your site, on position where provided code is added. That is pay per click model, what means that every click on links/banner is cash in your pocket. Adsense ads are automatically targeted according to theme (keywords) of your page, and on the first sight, it is looking easy to monetize your site on this way. But, it is not that easy.
Maybe some of readers will be disappointed, but purpose of this article is not how to buy your first car from adsense checks. Instead of that, this article can help you to pay hosting expenses at least, making happy Google, visitors, advertisers and you.
So, forget MFA (made for adsense) sites, high paying keywords and arbitrage, for this kind of optimization, there is only small effort required.

AdSense Preview tool
High traffic page, with no matching product or CPA offer to cover theme of that page, is what we need for test.
For initial check, you need to download AdSense preview tool, i.e plug-in for Internet Explorer. that is small *.reg file and installation is easy (double click on file).
So, go to AdSense Preview tool page, read instructions, download and install that plugin. More about AdSense Preview tool you can read on this page
Installed? Now, go to that test page. If that page is already indexed, and you can find it in Google index (search engine results), it is better. Now, right mouse click (anywhere on page), select Google AdSense Preview Tool, and, after small window is displayed, select country (see pic below, geographic targeting). At this time, Google spider is checking your page for keywords, according to those keywords (theme), you will see ads inside preview tool window. Now, compare ads inside widow with your page theme.
Below is screenshot of adsense preview tool window, taken after uploading this page. As you can see, ads are related to this page theme.

Web Page optimization
If your test page receives traffic from search engines, every touch can change your position. If it is not that important, you can change or replace word here and there, using preview tool as optimization tool. According to ads displayed, you can guess what keywords are targeted. Now, tweak your page in small steps to get ads what will match theme, adding or replacing keywords in title, headings and body (top middle, bottom).

What ads are displayed on site page?
If your site is targeted to USA visitors, and you are from outside USA, you will not see same ads as USA visitor. You have to use proxy in targeted country to control what ads are displayed to your targeted visitors.
Now, to fine tune ads displayed on your site, get leather board or skyscraper code and add it somewhere on your page. If it is necessary, connect using proxy. Look at sites displayed in ads block. High paying ads are on top, but if you want to remove some sites from that block, use "competition filter" on your adsense account and add those domains there.

Ads position
Net is covered with advises for adsense ads position, how to blend ads into content, how to push visitor to click on ad...
In our test page, purpose to add adsense block is to fill unused space, and to get some return for our effort. In that case, we still want to keep our visitor, not to push him out for a few cents. That is different story, site content is what is attracting visitors, not ads. Overloading site with adsense ads is not recommended, not only due to lower payment from lower positioned ads. Adsense ads are all over the Net, and they are recognized as banners before. If you care for your visitors, do not blend (mix) ads with content, so that they are looking like site menu (like I did it on bottom of this page), or links to the part of your site. Visitor don't like to feel cheated or used (you too?).
So, we will offer adsense to visitor as an option. On the end of this article, as example, is one block of ads, what could be interesting for you, or maybe not. If you are reading this now, that means that content is interesting, and your next focus could be on those ads. And, if ads are positioned in the middle of this article, or on the right side of this page will be (probably) skipped. The catch is to present visitor something what will offer more information about theme. In that case ads will be effective and visitor will not leave your site forever.

Most successful AdSense ads formats
Simple enough, three factors are important to target adsense ads better and to get better CTR (click-through rate.). Ads format, page theme (keywords), and Ads block position on page. These examples below are not suitable for websites where you are trying to build trust, and keep visitors. On marketing theme websites, where visitor is familiar with AdSense, my suggestion is to use other kind of advertising, due to possible low CTR.
First, to blend ads better, font size should the same as AdSense ads (10px), link color the same as links on your site. Most used type is the large block. Position of two blocks above the fold (looking like only content on the page) shows very high CTR (MFA sites). On directory type websites, this large block could be blended in directory listing (on the end of listing). Also, on this type of websites, a few single ad blocks can be mixed into listing. (between listed websites)
One more format, often used on "visitor, go away" websites is "menu". Positioned on top left corner of page, where visitor expect to see links to other sections of website, it gets good CTR if it is blended good in website menu (positioned above real menu). Horizontal menu block could be added on top or bottom of page.
Along with those three factors mentioned above, more are in the game. Colors on your website, hot spots and content are playing here also. The best way to find good ad format and position on page is testing. Read below.

AdSense tracking
For simple tracking (CTR) you need to create channel. So, for your test page, create channel for every ad format you want to test on that page. Testing ads on that page, you will spot most effective format and position. Don't forget, if some format is working on one site or web page, it doesn't mean that it is working on every site. Test adsense format and position on your site until you get best CTR.
There some JavaScripts available, what can help to find what ads are clicked, and , according to that, some ads can be excluded using "competition filter", leaving only ads what attracts clicks, but that is an other story, not covered here.
Anyway, to target AdSense ads better, you need to tune your page for related set of keywords, especially those paragraphs above and below block where AdSense ads are displayed. And, those links at bottom, if they are, on the first sight, looking like menu, that is not menu.

Wednesday, July 1, 2009

Facebook-Style Modal Box Using MooTools

In my oh-so-humble opinion, Facebook’s Modal box is the best modal box around. It’s lightweight, subtle, and very stylish. I’ve taken Facebook’s imagery and CSS and combined it with MooTools’ awesome functionality to duplicate the effect.
Facebook uses a funky sprite for their modal box. Pretty cool though.

/* from facebook */
.generic_dialog { height:0; left:0;
overflow:visible; position:fixed; /*dw*/ top:0; width:100%; z-index:101;
#generic_dialog_iframe { left:0; position:absolute; top:0; z-index:3;
.generic_dialog .generic_dialog_popup { height:0; overflow:visible;
position:relative; }
.generic_dialog div.dialog_loading {
background-color:#F2F2F2; border:1px solid #606060; font-size:24px;
padding:10px; }
#generic_dialog_overlay { display:block; left:0;
position:absolute; top:0; width:100%; z-index:100; }
.dialog_content_img { float:left; margin-right:15px; }
.dialog_content_txt { float:left; padding-bottom:5px; width:300px;
.dialog_body .dialog_content_body { padding-bottom:13px; }
.form_label { padding-right:5px; }
.dark_dialog_overlay {
background-image:url(facebook-overlay.png); background-repeat:repeat; }
html .dark_dialog_overlay { background-color:transparent;
background-image:url(blank.gif); }
.full_bleed .pop_dialog_table
td.pop_content .dialog_body { padding:0; }
table.pop_dialog_table {
border-collapse:collapse; direction:ltr; margin:auto; table-layout:fixed;
width:465px; }
td.pop_topleft, td.pop_topright, td.pop_bottomleft,
td.pop_bottomright { height:10px; overflow:hidden; padding:0 !important;
width:10px !important; }
td.pop_topleft { background:transparent
url(facebook-pop-dialog-sprite.png) no-repeat scroll 0 0; }
td.pop_topright {
background:transparent url(facebook-pop-dialog-sprite.png) no-repeat scroll 0
-10px; }
td.pop_bottomleft { background:transparent
url(facebook-pop-dialog-sprite.png) no-repeat scroll 0 -20px;
td.pop_bottomright { background:transparent
url(facebook-pop-dialog-sprite.png) no-repeat scroll 0 -30px; }
td.pop_bottom { background:transparent url(facebook-pop-dialog-sprite.png)
repeat-x scroll 0 -40px; }
td.pop_side { background:transparent
url(facebook-pop-dialog-sprite.png) repeat-y scroll -10px 0; }
{ background-color:white; direction:ltr; padding:0; }
td.pop_content { direction:rtl; }
td.pop_content h2.dialog_title {
background:#6D84B4 none repeat scroll 0 0; border:1px solid #3B5998;
color:white; font-size:14px; font-weight:bold; margin:0; }
h2.dialog_loading { background:#6D84B4 url(facebook-indicator_white_small.gif)
no-repeat scroll 400px 10px; padding-right:40px; }
td.pop_content h2 span {
display:block; padding:4px 10px 5px; }
td.pop_content .dialog_content {
background:#FFFFFF none repeat scroll 0 0; border-color:#555555;
border-style:solid; border-width:0 1px 1px; }
td.pop_content .dialog_body {
border-bottom:1px solid #CCCCCC; padding:10px; }
.dialog_summary { background:#F2F2F2 none repeat scroll 0 0; border-bottom:1px
solid #CCCCCC; padding:8px 10px; }
td.pop_content .dialog_buttons {
background:#F2F2F2 none repeat scroll 0 0; padding:8px; text-align:right;
td.pop_content .dialog_buttons input { margin-left:5px; }
.dialog_buttons_msg { float:left; padding:5px 0 0; }
.dialog_footer { background:#F2F2F2 none repeat scroll 0 50%; }
/* david
walsh custom */
#fb-modal { display:none; }
#fb-close { cursor:pointer;
.info { width:280px; float:left; font-size:11px; color:#666; }
.info b {
color:#000; }
.image { width:200px; float:left; margin-right:10px; }

Most of this CSS was copied straight from Facebook’s stylesheets. You’ll see a bit of custom CSS at the bottom but that’s just me customizing the content in the modal box.
window.addEvent('domready',function() {
/* hide using opacity on page load
hiders */
$('fb-close').addEvent('click',function(e) {
$('fb-modal').fade('out'); });
window.addEvent('keypress',function(e) {
if(e.key == 'esc') { $('fb-modal').fade('out'); }
$(document.body).addEvent('click',function(e) {
if($('fb-modal').get('opacity') == 1 &&
!'.generic_dialog')) {
/* click to show */

Just because Facebook has more resources than you doesn’t mean your site can’t look as good as Facebook!