Archive for February, 2010

Published by Pui-chor on 14 Feb 2010

Browser/WebServer communicates..

The browser such as IE, firefox, opera, chrome or others communicates with the webserver through the two basic methods (others methods are not as usual):

1. Normal requests are through the URL and is called the GET method.

2. Form data submission from the browser are transmitted through the POST method as the data will not be visualized from the URL’s requests.

The communication is illustrated with the follwing PERL program:

$content_type = $ENV{‘CONTENT_TYPE’};
$content_len = $ENV{‘CONTENT_LENGTH’};

# Query the GET method’s DATA

# Buffer the POST method’s DATA
binmode STDIN;
read(STDIN, $buffer, $content_len);

$ENV{”} … are the environment variables that the server collected and passed on to the script to handle the information. Pay attention to the $method variable to see whether the requested method is GET or POST.

The GET method gets the data from the query string passed on from the URL after the question mark such as:… The query is extracted as a=1&b=2… Each data is a pair of name=value and concatenate with & symbol.

The POST method gets the data from the standard input stream and in PERL it is STDIN. STDIN is similar to the keyboard input from the computer. The format of the data is pretty much the same except a few such as the file upload content.

Published by Pui-chor on 14 Feb 2010

Multiple files upload content

When multiple files are uploaded, the content presented to the server and subsequently extracted and stored is shown below:

Multiple file uploaded content

Published by Pui-chor on 14 Feb 2010

「道德 經」的第三章

老子的「道 德 經」: 第 三 章
不 尚 賢 , 使 民 不 爭 ﹔不 貴 難 得 之 貨 , 使 民 不 為 盜 ﹔不 見 可 欲 , 使 民 心 不 亂 。是 以 聖 人 之 治 ,虛 其 心 ,實 其 腹 ,弱 其 志 ,強 其 骨 。 常 使 民 無 知 無 欲 。使 夫 智 者 不 敢 為 也 。 為 無 為 , 則 無 不 治 。




Next »