Custom Google Search

Hits: 2948  

Google Custom Search service provide customized search for web on your site or blog.

1. We can add site’s links to get fast and relevant search results
2. We can make money with AdSense for Search
3. We can invite friends and community to contribute
4. We can include one or more websites, or specific webpages
5. We can host the search box and results on your own website
6. We can customize the look and feel of the results to match your site

We can make topic / site specific search on google see below

Magento Search Engine

We can integrate custom google search with our site search, we have to add below to our site…

<script type=”text/javascript”>

window.onload = function()

jQuery(“.gsc-input”).focus();  // google search input box

jQuery(“.gsc-input”).val(‘<?php echo isset($_REQUEST[‘q’])?$_REQUEST[‘q’]:”; ?>’); // auto fill site’s search keyword to custome search

jQuery(“.gsc-search-button”).click(); // trigger submit event



Waves are my inspiration, not because they rise and fall, but each time they fall They Rise Again… 🙂

Image Map in FBML

Hits: 2356  

Facebook FBML application does not support hotspots in an image map using dreamweaver.

<div style="position: relative;">
<!-- Hot Spots - Image Map -->
<div id="svnlabs1" style="background: none repeat scroll 0% 0% transparent; cursor: pointer; outline: medium none; text-align: center; vertical-align: middle; position: absolute; top: 72px; left: 460px; z-index: 99; padding: 10px;"></div>
<div id="svnlabs2" style="background: none repeat scroll 0% 0% transparent; cursor: pointer; outline: medium none; text-align: center; vertical-align: middle; position: absolute; top: 11px; left: 635px; z-index: 99; padding: 10px;"></div>
<div id="svnlabs3" style="background: none repeat scroll 0% 0% transparent; cursor: pointer; outline: medium none; text-align: center; vertical-align: middle; position: absolute; top: 170px; left: 632px; z-index: 99; padding: 10px;"></div>
<div id="svnlabs4" style="background: none repeat scroll 0% 0% transparent; cursor: pointer; outline: medium none; text-align: center; vertical-align: middle; position: absolute; top: 78px; left: 887px; z-index: 99; padding: 10px;"></div>
<!-- Main Image -->
<img src="" border="0" alt="" align="absbottom" /></div>

We can use above code to map image using DIV elements on main image.
It is quite useful to insert hotspots on Images in FBML 😉

Maturity is not when we start speaking BIG things But..Actually it is, When we start understanding small things.

Amazon E-Commerce Service or ECS

Hits: 2286  

Amazon’s ECS is very good service for accessing Amazon’s product database. We can register to this web service quickly, It provides a free access key to access Amazon Store.

Amazon have rich set of web services 🙂 Web Services are used to access DATA over cross platform environments.

Using ECS-driven websites and applications, we can earn commissions by advertising items for sale by Amazon.

Amazon E-Commerce Service can be used to get the information from amazon such as product name, images, availability, ratings, description, specifications, similar products, and more.

We can use PHP to consume web service using PEAR, REST, SOAP and XML etc.


There is one thing which gives radiance to everything. It is the idea of something around the corner.

Recursive Replace in Files Folders

Hits: 1913  
Hello Friends,
Some time we want to change branding of web based softwares. Open source web based software have GNU License. We can modify the code and launch versions.
We can use PERL (Perl is a highly capable, feature-rich programming language with over 22 years of development.)
Here are some basic steps to Recursive Replace Rename Files, Variables, Folder Name etc.
Let you have a project in folder "/root/svnlabs"
To replace search string in all filename and foldernames recursively

# chmod a+x ./

# perl -m g 'search_text' 'replace_text'

# chmod a+x ./

# perl -m g 'Search' 'Replace'

# grep -iRl 'Search' /root/svnlabs  (Now search in your project)

If you would hit the mark, you must aim a little above it 😉

Google Ads PHP Class

Hits: 2290  

Google AdSense: AdSense is an ad serving application run by Google Inc. Website owners can enroll in this program to enable text, image, and video advertisements on their websites. These advertisements are administered by Google and generate revenue on either a per-clickor per-impression basis.

Normal Ad Unit:
728x90_as (Leaderboard)
468x60_as (Banner
234x60_as (Half Banner)
125x125_as (Button)
120x600_as (Skyscraper)
160x600_as (Wide Skyscraper)
180x150_as (Small Rectangle)
120x240_as (Vertical Banner)
200x200_as (Small Square)
250x250_as (Square)
300x250_as (Rectangle)
336x280_as (Large Rectangle)

Link Unit:
120x90_0ads_al (4 links)
120x90_0ads_al_s (5 links)
160x90_0ads_al (4 links)
160x90_0ads_al_s (5 links)
180x90_0ads_al (4 links)
180x90_0ads_al_s (5 links)
200x90_0ads_al (4 links)
200x90_0ads_al_s (5 links)
468x15_0ads_al (4 links)
468x15_0ads_al_s (5 links)
728x15_0ads_al (4 links)
728x15_0ads_al_s (5 links)

google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = “300x250_as”;
google_ad_type = “text_image”;
google_alternate_ad_url = “”
google_ad_channel = “XXXXXXXXXX”;
google_color_border = “FFFFFF”;
google_color_bg = “FFFFFF”;
google_color_link = “0000FF”;
google_color_text = “000000”;
google_color_url = “005577”;


//Fill in Google Adsense Publisher ID.
$google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
//Select Google Adsense Format to display
$google_ad_format = “468x60_as”;
//Fill in Ad Channel ID if you have one. Leave it blank if do not have.
$google_ad_channel = “”;
//Select Ad Type
$google_ad_type = “text_image”;
//Ad Border Color
$google_color_border = “FFFFFF”;
//Ad Background Color
$google_color_bg = “FFFFFF”;
//Ad Link Color
$google_color_link = “0000FF”;
//Ad Text Color
$google_color_text = “000000”;
//Ad URL Color
$google_color_url = “005577”;

switch ($google_ad_format)
$google_ad_width = 728; $google_ad_height = 90;
$google_ad_width = 468; $google_ad_height = 60;
$google_ad_width = 234; $google_ad_height = 60;
$google_ad_width = 120; $google_ad_height = 600;
$google_ad_width = 160; $google_ad_height = 600;
$google_ad_width = 120; $google_ad_height = 240;
$google_ad_width = 300; $google_ad_height = 250;
$google_ad_width = 250; $google_ad_height = 250;
$google_ad_width = 336; $google_ad_height = 280;
$google_ad_width = 180; $google_ad_height = 150;
$google_ad_width = 728; $google_ad_height = 15;
$google_ad_width = 468; $google_ad_height = 15;
$google_ad_width = 120; $google_ad_height = 90;
$google_ad_width = 160; $google_ad_height = 90;
$google_ad_width = 180; $google_ad_height = 90;
$google_ad_width = 200; $google_ad_height = 90;
$google_ad_width = 728; $google_ad_height = 15;
$google_ad_width = 468; $google_ad_height = 15;
$google_ad_width = 120; $google_ad_height = 90;
$google_ad_width = 160; $google_ad_height = 90;
$google_ad_width = 180; $google_ad_height = 90;
$google_ad_width = 200; $google_ad_height = 90;

<script type=”text/javascript”><!–
google_ad_client = “<?php echo $google_ad_client; ?>“;
google_ad_width = <?php echo $google_ad_width; ?>;
google_ad_height = <?php echo $google_ad_height; ?>;
google_ad_format = “<?php echo $google_ad_format; ?>“;
google_ad_type = “<?php echo $google_ad_type; ?>“;
google_ad_channel = “<?php echo $google_ad_channel; ?>“;
google_color_border = “<?php echo $google_color_border; ?>“;
google_color_bg = “<?php echo $google_color_bg; ?>“;
google_color_link = “<?php echo $google_color_link; ?>“;
google_color_text = “<?php echo $google_color_text; ?>“;
google_color_url = “<?php echo $google_color_url; ?>“;
<script type=”text/javascript”


Block badAgents on site

Hits: 1965  

PHP is very powerful language to block bad agents. Below is the code to avoid webspider using PHP in_array().

= array(‘Acunetix Web Vulnerability Scanner’, ‘Bot\’, ‘ChinaClaw’, ‘Custo’, ‘DISCo’, ‘Download\ Demon’, ‘eCatch’, ‘EirGrabber’, ‘EmailSiphon’, ‘EmailWolf’, ‘Express\ WebPictures’, ‘ExtractorPro’, ‘EyeNetIE’, ‘FlashGet’, ‘GetRight’, ‘GetWeb!’, ‘Go!Zilla’, ‘Go-Ahead-Got-It’, ‘GrabNet’, ‘Grafula’, ‘HMView’, ‘HTTrack’, ‘Image\ Stripper’, ‘Image\ Sucker’, ‘Indy\ Library’, ‘InterGET’, ‘Internet\ Ninja’, ‘JetCar’, ‘JOC\ Web\ Spider’, ‘larbin’, ‘LeechFTP’, ‘Mass\ Downloader’, ‘MIDown\ tool’, ‘Mister\ PiX’, ‘Navroad’, ‘NearSite’, ‘NetAnts’, ‘NetSpider’, ‘Net\ Vampire’, ‘NetZIP’, ‘Octopus’, ‘Offline\ Explorer’, ‘Offline\ Navigator’, ‘PageGrabber’, ‘Papa\ Foto’, ‘pavuk’, ‘pcBrowser’, ‘RealDownload’, ‘ReGet’, ‘SiteSnagger’, ‘SmartDownload’, ‘SuperBot’, ‘SuperHTTP’, ‘Surfbot’, ‘tAkeOut’, ‘Teleport\ Pro’, ‘VoidEYE’, ‘Web\ Image\ Collector’, ‘Web\ Sucker’, ‘WebAuto’, ‘WebCopier’, ‘WebFetch’, ‘WebGo\ IS’, ‘WebLeacher’, ‘WebReaper’, ‘WebSauger’, ‘Website\ eXtractor’, ‘Website\ Quester’, ‘WebStripper’, ‘WebWhacker’, ‘WebZIP’, ‘Wget’, ‘Widow’, ‘WWWOFFLE’, ‘Xaldon\ WebSpider’, ‘Zeus’);
in_array($_SERVER[‘HTTP_USER_AGENT’],$badAgents)) {

UTF-8 FTP Tools

Hits: 2876  

FTP Tools / Clients are most useful for transferring files and data to server.

There are many FTP clients used in File Transfer, please use for more details…

Some time file transfer is not secure and reliable using various tools, file become corrupted or some special characters added to files.

You have to use UTF8 encoding while files transfer. Only some FTP tools use UTF8 encoding while uploading and downloading files.

To remove special chars from live sites, you have to use UTF8 based FTP tools.

FileZilla now have UTF8 support. So, next time while you are creating webpages in different languages; you can use UTF-8 based FTP tools to avoid characters problems 😉

Override PHP Function

Hits: 3353  

PHP have PECL (PHP Extension & Community Library) function to override built-in functions by replacing them in the symbol table.

bool override_function ( string $function_name , string $function_args , string $function_code )


  1. <?php
  2. override_function(‘strlen’, ‘$string’, ‘return override_strlen($string);’);
  3. function override_strlen($string){
  4. return strlen($string);
  5. }
  6. ?>

The above function “override_function()” require APD i.e. Advanced PHP Debugger.

We can find more about APD here…

Linux users can install apd using below command

# pecl install apd

There is an alternate way to override PHP functions, we can use below class “override” to override any built-in PHP function if PECL is not installed on server 😉


  1. <?php
  2. $or = new override ();
  3. $or->override_function(‘strlen’, ‘override_strlen‘, ‘return override_strlen($string);’);
  4. function override_strlen($string){
  5. return strlen($string);
  6. }
  7. ?>




$url = '';
$override = new override();



if ($over_func_name = $override->override_check('file_get_contents')) {
    $result=call_user_func($over_func_name, $url);

function fileGetContents($url)
  /// statements



PHP Function OverRide Class


class override 

var $functions = array(); 
var $includes = array(); 

function override_function($override, $function, $include) { 
 if ($include) { 
 $this->includes[$override] = $include; 
 else if (isset($this->includes[$override])) { 
 $this->functions[$override] = $function; 

function override_check($override) { 
 if (isset($this->includes[$override])) { 
 if (file_exists($this->includes[$override])) { 

if (function_exists($this->functions[$override])) {
 return $this->functions[$override]; 
 return false; 
return false; 


Make a habit of creating things modular, that means “pluggable” and “unpluggable”.

Web scraping using firefox & jQuery

Hits: 7392  

Hello Friends,

Today we will scrape HTML from any web page using jQuery and firefox firebug console. This is useful when you want to grab HTML of web page dynamically created by JavaScript or Ajax.

This example is quite useful when you want to extract any web content based on HTML Tag element ID or Class like ‘<div id=”svnlabs”></div>’ or ‘<img src=”svnlabs.jpg” id=”svn_labs”>’

See the code in action here… scraper.txt

jQuery(“body”).append(‘<textarea id=”svnlabs” cols=”70″ rows=”20″></textarea>’);



copy and paste below code in browser address bar….

javascript: jQuery(“body”).append(‘<textarea id=”svnlabs” cols=”70″ rows=”20″></textarea>’); jQuery(“#svnlabs”).val(jQuery(“body”).html());

You have to post above code in firefox firebug javascript console. The latest jQuery library must be included on that web page you want to scrap 😉
Above two JavaScript lines will add a new textarea in body of same web page to set content of any HTML element. Please make sure after copy the above code; no illegal character in it.

Keep blogging……… 😉

Open source – Port25

Hits: 2401  

If you have trouble getting the PHP’s mail() function to work on your server.
If the function returned true, but never send the emails to target account.
Some ISP’s block port 25 (mail port), so you can’t send directly but you can send indirectly using your ISP’s mail server. 😉

Many email providers keep lists of IP addresses and block incoming mail, or move it immediately to a junk/spam folder.

Amazon Simple Notification Service Command Lines

There are some Open Source solutions to filter your mail problems..
You can check Open Source MTA here

Here list some MTAs as

  1. postfix
  2. qmail
  3. exim
  4. sendmail

Above MTA don’t handle integrated reporting, bounce management, and spam management, reporting.

PowerMTA: PowerMTA (this is not open source) provides the unique features and capabilities required by email service providers and enterprises to maximize the effectiveness of email marketing and customer communications, handle integrated reporting, bounce management, and spam management, reporting etc.