How to call perl or php script from HTML file?

Easiest way to do this is call php/perl script as javascript. Since javascript is client side stuff, php or perl script need to writeback output using javascript commands only. This is useful if you have lots of HTML files and would like to do some server side processing. For example Tips & Tricks section on our site has lots of html pages which uses code as follows:

<script language="JavaScript" type="text/javascript" src="">

Above code generates recent post posted in blog. Main advantage of this technique is simple, you can use it from HTML file and your javacode is also hidden (although other better ways exists to do this).

(A) An example of PERL, create file called as follows and put into your cgi-bin directory:

use strict;
use warnings;
use CGI;
my $q = CGI->new();
my $info = "Server: ". $ENV{'SERVER_NAME'} . "
Script name: ". $ENV{'SCRIPT_NAME'}; # need to send header otherwise sky will fall on you print $q->header(); # always get back to user after perl code print "document.write('Hello world
I am called from HTML page $ENV{'HTTP_REFERER'}
');"; print "document.write('$info');";

Add following line to your HTML code (replace with your real domain name):

<script language="JavaScript" type="text/javascript" 

(B) An example of PHP, create file called html.php as follows and put into your webserver directory:

 $ser = "Server: ". $_SERVER['SERVER_NAME'] .  "
Script name: ". $_SERVER['SCRIPT_NAME']; echo "document.write('Hello World
I am php code called from HTML file:' );"; echo "document.write('$ref
');"; echo "document.write('$ser');"; ?>

Add following line to your HTML code (replace with your real domain name):

<script language="JavaScript" type="text/javascript" 

PHP code is bit easier to use as compare to PERL.

How to redirect url with perl script

It is common scenario when you need to tell the browser to redirect or look elsewhere for a page because you don’t want to produce a document yourself.

For example should redirect to a page/url

Here is perl code to redirect web page to


use strict;

use warnings;

my $url = "";

print "Location: $url\n\n";

However this code misses the functionality to get URL as input, this can be easily done using standard CGI module. Please see script code.

i) Just download the rd.tar.gz script (click on download) or use wget command at shell prompt:
$ wget

ii) Copy script to your cgi-bin directory or directory where perl script execution allowed
iii) Suppose your domain name is and you put this script in directory called cgi-bin then to execute this script simply type or even ftp url

Choose a job you love

Recently I quit job that I don’t like at all, I was doing the job because I had no other choice. until I read an ancient tao thought which says “Choose a job you love and won’t have to work a day in your life!”

Next day I left the job! Don’t work for wages, work for the love of God. If you love your work, you love God. And God will also love you. Truest me this what my experience so far. Now my job becomes a source of joy and delight.

Cybersquatting is big bad business

In dotcom era cybersquatting was at its peak. Basically booking or using domain names with bad-faith to make profit from the goodwill of a trademark belonging to large/small corporations. They also try to sell these domains for profit to others or even to business itself. Even after DOT-COM crash Cybersquatting still continues because of profits.

I remember when I uses to sell computers and my firms name was ‘Cyberciti Computers’, so I booked domain. I used to get an email from someone who claims to owner of domain and willing to sell me the same.

By past mistakes I have also learned lesson to renew domains on time. My first domain was taken by someone. So if you got domain make sure you rename it on time or even in advance.

If someone takes your domain related to your business then you can take the help of laws. If you are in US you can take help of 1999 US federal law known as the Anti-Cybersquatting Consumer Protection Act. I don’t think so we have any such law in India, under IT Act 2000.

Switzerland (swiss post) will issue the worlds first MMS stamp

Scheduled to release on September, 2005. Swiss Post, Swisscom Mobile and Museum for Communication organized a competition, where user submitted MMS photo taken using a camera & MMS capable mobile phone to the website.

This the first time four mobile phone photographers are being honoured. They used Multimedia Messaging Service (MMS) to submit over 3,300 MMS photos taken by owners of mobile phone and final 100 were selected using the public votes . Finally specialist jury composed of representatives from the three project partners then selected four of these MMS pictures, which will now feature on the new stamps.

You can view these stamps online at MMS stamps page along with photos of winners

More information please visit official swiss post website.

Seven steps to success

Recently I came across Sunday Time of India article written by Chirs Widener. Article highlights the seven steps to success as follows:

i)Give others your honesty
ii)Give others your respect
iii) Give others your vulnerability
iv) Give others your care
v)Give others your passion
vi) Give others your experience
vii) Give others your help

I must agree with author and just would like to add one more rule to this list

“Every action has opposite reaction (Newton’s Third Law of MotionFor every action there is an equal and opposite reaction.) so if you do good to others (by giving your honesty, respect, care, help etc) same comes back to you”.

Indeed last rules summaries all of above rules.

An Effect of Mumbai cold

Rest of country feels heat when mumbai catches cold. ATMS stopped functioning across country, BSE and NSE stops trading bringing down financial system. And don’t ask about air, road and rail links all of them are halted.

Once again Mumbai is flooded, I don’t understand why the hell in our country we don’t learn lessons from past. Be it earthquakes, floods, epidemics etc our disaster management sucks for sure. And government never wake up in time.