Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi 3 CGI Applications.

Posted on 1998-02-25
5
Medium Priority
?
252 Views
Last Modified: 2010-04-06
I'm after some demos with source for simple CGI programs...Just to get me started....
0
Comment
Question by:hamishd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:hamishd
ID: 1359810
Adjusted points to 200
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 800 total points
ID: 1359811
Hi,

some components with source :

http://torry.rimini.com/vcl/internet/delphcgi.zip

and a little demo :

Not made by me!

L> I don't understand though how to send the output from the CGI to the web
RL> server.

Yeah, I spend a whole weekend before I got it right. Here's a sample program
I wrote for developing 32bit Delphi console GCI apps. It still needs work,
like return variable values and so on. But it is at least a start.

regards,
Billy
program test;

{$APPTYPE CONSOLE}

uses WinProcs, WinTypes, SysUtils;

type
  TCGIData = class
    public
      {following variables are set by the Web Server as o/s environmental
      variables}
      RequestMethod : String;  {from html FORM METHOD=??}
      PathInfo      : String;
      QueryString   : String;  {query string from server}
      RemoteHost    : String;  {ip address of client browser}
      ContentType   : String;
      ContentLength : LongInt;
      HttpUserAgent : String;  {client's browser signature}
      constructor Create;
  end;


constructor TCGIData.Create;
{reads the environmental variables}
var
  lpsz : Pchar;
begin
  lpsz := StrAlloc(1024*10);

  if GetEnvironmentVariable( 'Request_Method', lpsz, 1024*10 ) > 0 then
    RequestMethod := StrPas(lpsz)
  else
    RequestMethod := '';

  if GetEnvironmentVariable( 'Path_Info', lpsz, 1024*10 ) > 0 then
    PathInfo := StrPas(lpsz)
  else
    PathInfo := '';

  if GetEnvironmentVariable( 'Query_String', lpsz, 1024*10 ) > 0 then
    QueryString := StrPas(lpsz)
  else
    QueryString := '';

  if GetEnvironmentVariable( 'Remote_Host', lpsz, 1024*10 ) > 0 then
    RemoteHost := StrPas(lpsz)
  else
    RemoteHost := '';

  if GetEnvironmentVariable( 'HTTP_User_Agent', lpsz, 1024*10 ) > 0 then
    HttpUserAgent := StrPas(lpsz)
  else
    HttpUserAgent := '';

  if GetEnvironmentVariable( 'Content_Type', lpsz, 1024*10 ) > 0 then
    ContentType := StrPas(lpsz)
  else
    ContentType := '';

  if GetEnvironmentVariable( 'Content_Length', lpsz, 1024*10 ) > 0 then
    ContentLength := StrToInt(lpsz)
  else
    ContentLength := 0;

  StrDispose(lpsz);
end;

var
  CGI : TCGIData;

begin
  CGI := TCGIData.Create;
  WriteLn('MIME-version: 1.0');
  WriteLn('Content-type: text/html');
  WriteLn;
  WriteLn('');
  WriteLn('');
  WriteLn('');
  WriteLn('');
  WriteLn('

');
  WriteLn('');
  WriteLn('This CGI is written in Delphi II. The following information ');
  WriteLn('is available to this CGI from the Web Server:
');
  WriteLn('');
  WriteLn('
   Request method for this CGI : '+CGI.RequestMethod);
  WriteLn('
   Path : '+CGI.PathInfo);
  WriteLn('
   Parameters : '+CGI.QueryString);
  WriteLn('
   Content Type : '+CGI.ContentType);
  WriteLn('
   Your IP address : '+CGI.RemoteHost);
  WriteLn('
   Your Browser''s signature : '+CGI.HttpUserAgent);
  WriteLn('
');
  WriteLn('

');
  WriteLn('');
  WriteLn('
Coyright © Whoever 1996
');
  WriteLn('');

  CGI.Free
end.

regards,Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359812
0
 

Author Comment

by:hamishd
ID: 1359813
Dear Time Saver,

Thank you. I'm sure you know how hard it is to find source on the internet for delphi CGI programming. You have made my life easier....


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359814
Glad I could help.

Regards, zif.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question