CGI
-
Paul Dwyer
- User

- Posts: 44
- Joined: Wed Nov 05, 2003 4:34 am
- Location: Tokyo, Japan
CGI
I was just wondering how I can get post and get variables from a website when writing a CGI app.
Generally you look in environment variables for the data but I can't see how purebasic reads Environment variables...
anyone have a real simple CGI example?
Generally you look in environment variables for the data but I can't see how purebasic reads Environment variables...
anyone have a real simple CGI example?
Paul Dwyer
Network Engineer
Aussie in Tokyo
Network Engineer
Aussie in Tokyo
There is a usermade library avaiable to use CGI.
http://www.reelmediaproductions.com/pb/
Just type 'CGI' in the search box at the top, and you'll find it.
Timo
http://www.reelmediaproductions.com/pb/
Just type 'CGI' in the search box at the top, and you'll find it.
Timo
quidquid Latine dictum sit altum videtur
-
Paul Dwyer
- User

- Posts: 44
- Joined: Wed Nov 05, 2003 4:34 am
- Location: Tokyo, Japan
> Other languages have a GetEnv or Environ$() call to get the data,
The lib doesn't do much more than that. There are functions to
decode/encode Urls, and one to send the Output back, that's all.
and, no PB doesn't have a way for that, why else should there be a lib for it?
Timo
The lib doesn't do much more than that. There are functions to
decode/encode Urls, and one to send the Output back, that's all.
and, no PB doesn't have a way for that, why else should there be a lib for it?
Timo
quidquid Latine dictum sit altum videtur
-
Paul Dwyer
- User

- Posts: 44
- Joined: Wed Nov 05, 2003 4:34 am
- Location: Tokyo, Japan
-
Paul Dwyer
- User

- Posts: 44
- Joined: Wed Nov 05, 2003 4:34 am
- Location: Tokyo, Japan
> Is a whole lib really needed?
PureBasic will (usually) just include the command data from a lib into
your final exe (if the lib is coded that way). So no, using one command
from a library doesn't always include the whole library code in your exe.
> Does PB not have a way to get an environment var?
Not as a native command, but you can do it with the API:
viewtopic.php?t=7019
Remember: if PureBasic lacks a command, you can almost always use
an API command (or two) to do the job instead.
(Although this is
only for Windows).
PureBasic will (usually) just include the command data from a lib into
your final exe (if the lib is coded that way). So no, using one command
from a library doesn't always include the whole library code in your exe.
> Does PB not have a way to get an environment var?
Not as a native command, but you can do it with the API:
viewtopic.php?t=7019
Remember: if PureBasic lacks a command, you can almost always use
an API command (or two) to do the job instead.
only for Windows).
-
Paul Dwyer
- User

- Posts: 44
- Joined: Wed Nov 05, 2003 4:34 am
- Location: Tokyo, Japan
Hi,
This is, more or less, what the StdIn command of the CGI lib does, translated to PB+Win32API:
This code is useless if ran as is, in console mode, but it's helpful if you use it as CGI input.
I think it should be easy to do this in Linux (should be easier, so they say
Regards,
This is, more or less, what the StdIn command of the CGI lib does, translated to PB+Win32API:
Code: Select all
bRead.l
hInput = GetStdHandle_(#STD_INPUT_HANDLE)
GetSystemInfo_(sinf.SYSTEM_INFO)
SetConsoleMode_(hInput, #ENABLE_LINE_INPUT|#ENABLE_ECHO_INPUT|#ENABLE_PROCESSED_INPUT)
Buffer = AllocateMemory(0, sinf\dwPageSize)
While ReadFile_(hInput, Buffer, sinf\dwPageSize-1, @bRead, 0) And bRead
Text$+PeekS(Buffer)
Wend
FreeMemory(0)
Debug Text$ ; there it is
I think it should be easy to do this in Linux (should be easier, so they say
Regards,
El_Choni

