Board index » delphi » Capturing Standard Input from a Web server?

Capturing Standard Input from a Web server?

Greetings!

I'm using OmniHTTPd Web server on Win98. I have it set up so a BP7.0
program will be executed if a file of type .abc is requested on the URL.

EG: www.example.com/test.abc   would invoke a BP7.0 program called
whatever.exe to run and send back content to the client's browser.

I'm having trouble communicating with the client's browser (retrieving
cookies for example). In Perl, the %ENV array is all there whenever you
execute a perl script. And the usual call to ReadParse(*in) sets up %in
for all POSTed data.

It's my understanding that all POSTed data and environment strings are
sent to STDIN. But I can't BP7.0 to read this.

Any clues?

Thanks!
Norton Warner
mailto:nwar...@datastar.com

 

Re:Capturing Standard Input from a Web server?


--
Rudolf Polzer
REBOUNCE - http://www.mycgiserver.com/~rebounce
I wish I was what I was when I wished I was what I am now.
"nwarner" <nwar...@datastar.com> schrieb im Newsbeitrag
news:39E74A63.4220@datastar.com...

Quote
> Greetings!

> I'm using OmniHTTPd Web server on Win98. I have it set up so a BP7.0
> program will be executed if a file of type .abc is requested on the URL.

[...]
> It's my understanding that all POSTed data and environment strings are
> sent to STDIN. But I can't BP7.0 to read this.

[...]

1. STDIN is called input in Pascal, and readln assumes it as default input
handle.
2. Try the GET method if nothing else works
3. Remember strings are limited to 255 chars in Pascal. Try a simple form.

This should work:

var s: string;
begin
    if (GetEnv ('REQUEST_METHOD') = 'POST') then
        readln (s)
    else
        s := GetEnv ('QUERY_STRING');
    writeln ('Content-type: text/plain');
    writeln;
    writeln (s);
end.

Other Threads