Click here to Skip to main content
12,827,242 members (44,017 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 26 Aug 2003

Remote System Information Using CGI

, 26 Aug 2003
Rate this:
Please Sign up or sign in to vote.
This is a handy utility to show system information of a remote computer by using common gateway interface known as CGI, a must have tool for administrators!

Sample Image - RemoteSysInfo.jpg


As most programmers know, CGI is an old but very useful techniques to create dynamic web pages. I use this technique for creating dynamic web pages that show system information. On the other hand, Administrators can put this program on their cgi-bin directory of web servers and getting information about their web servers like free memory, used memory, HDD space, system directories and etc remotely.

CGI Programming

Creating CGI based programs are an easy task. Below are steps that you should follow to create a CGI program:

  • Create a new console application. It is better to add support of MFC.
  • Add following line to stdafx.h:

    #include <iostream>
  • Use cout to redirect outputs to user's browser! You can use HTML tags to format your texts.

    Here is an example:

    #include <iostream>
    int main()
        cout << "content-type: text/html\n\n";  //HTTP header information
        //printing Hello World! message on user's browser!
        cout << "<html><head><title>Test CGI</title></head>";
        cout << "<body><p>Hello World!</p></body></html>";
        return 0;
  • Compile the program and put it to cgi-bin directory of your web server. If it does not exist, create one and change it's permission to "Execute (includes scripts)". Figure 2 shows this step.

    Setting Permission for cgi-bin directory

System Information

In my previous article, I showed you some ways to obtaining system information. Most of the code is taken from this article. By this program you can query system for these pieces of information.

  • Operating System Version (Thanks to PJ Naughter)
  • Computer Name
  • IP Address of Computer
  • User Name
  • Internet Explorer Version
  • Total RAM
  • Free Memory
  • Number of Hard Disk Drives
  • Hard Disk Total Space/Free Space/Used Space
  • CDROM Drives
  • Monitor Resolution
  • Color Depth
  • Number of CPUs (Thanks to Iain Chesworth)
  • CPU Speed
  • CPU Identifier
  • CPU Vendor Identifier
  • Operating System Folder
  • System Folder



This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

A. Riazi
CEO Misbah3Com
Iran (Islamic Republic of) Iran (Islamic Republic of)
I was born in Shiraz, a very beautiful famous city in Iran. I started programming when I was 12 years old with GWBASIC. Since now, I worked with various programming languages from Basic, Foxpro, C/C++, Visual Basic, Pascal to MATLAB and now Visual C++.
I graduated from Iran University of Science & Technology in Communication Eng., and now work as a system programmer for a telecommunication industry.
I wrote several programs and drivers for Synthesizers, Power Amplifiers, GPIB, GPS devices, Radio cards, Data Acqusition cards and so many related devices.
I'm author of several books like Learning C (primary and advanced), Learning Visual Basic, API application for VB, Teach Yourself Object Oriented Programming (OOP) and etc.
I'm winner of January, May, August 2003 and April 2005 best article of month competetion, my articles are:

You can see list of my articles, by clicking here

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
manoj kumar choubey26-Feb-12 20:55
membermanoj kumar choubey26-Feb-12 20:55 
GeneralBorland='OK', but VS2005='HTTP 500' Pin
Buzzlight2nd15-Jan-07 18:19
memberBuzzlight2nd15-Jan-07 18:19 
GeneralRe: Borland='OK', but VS2005='HTTP 500' Pin
Ralph in Boise15-Jan-07 19:17
memberRalph in Boise15-Jan-07 19:17 
GeneralRe: Borland='OK', but VS2005='HTTP 500' Pin
Ralph in Boise15-Jan-07 19:19
memberRalph in Boise15-Jan-07 19:19 
GeneralRe: Borland='OK', but VS2005='HTTP 500' Pin
Ralph in Boise15-Jan-07 19:20
memberRalph in Boise15-Jan-07 19:20 
QuestionEnumWindows() Pin
EviLDeD16-Nov-05 1:25
memberEviLDeD16-Nov-05 1:25 
AnswerRe: EnumWindows() Pin
A. Riazi16-Nov-05 20:35
memberA. Riazi16-Nov-05 20:35 
GeneralPotential security hole Pin
Arun Bhalla4-Sep-03 13:39
memberArun Bhalla4-Sep-03 13:39 
GeneralRe: Potential security hole Pin
A. Riazi5-Sep-03 19:50
memberA. Riazi5-Sep-03 19:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170326.1 | Last Updated 27 Aug 2003
Article Copyright 2003 by A. Riazi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid