GTCGI how to use ? - xharbour
This is a discussion on GTCGI how to use ? - xharbour ; Dear all,
first of all : Merry Christmas and happy new year !!!
now...
I see that exist a gt library called gtcgi. I tryed to include such
library in my Linux application but I do not know how this ...
-
GTCGI how to use ?
Dear all,
first of all : Merry Christmas and happy new year !!!
now...
I see that exist a gt library called gtcgi. I tryed to include such
library in my Linux application but I do not know how this gtcgi shoud
work... I do not nothing about CGI, just I read some tutorial how to
create web page... and I am asking if somebody can tell me how I gtcgi
should work....
Just to try what happens I call my program as follow "main //gtcgi"
and it enter in one infinite loop...
Thank you in advance.
Marco Bernardi
-
Re: GTCGI how to use ?
Marco
> now...
> I see that exist a gt library called gtcgi. I tryed to include such
> library in my Linux application but I do not know how this gtcgi shoud
> work... I do not nothing about CGI, just I read some tutorial how to
> create web page... and I am asking if somebody can tell me how I gtcgi
> should work....
> Just to try what happens I call my program as follow "main //gtcgi"
> and it enter in one infinite loop...
are your cgi app created with htmllib?
i just add to my apps
REQUEST HB_GT_CGI
and function gtsys
and on hbmake i change the -gtcrs to -gtcgi
Regards
Luiz
-
Re: GTCGI how to use ?
On 24 Dic, 15:02, "cul...@gmail.com" <cul...@gmail.com> wrote:
> Marco
>
> > now...
> > I see that exist a gt library called gtcgi. I tryed to include such
> > library in my Linux application but I do not know how this gtcgi shoud
> > work... I do not nothing about CGI, just I read some tutorial how to
> > create web page... and I am asking if somebody can tell me how I gtcgi
> > should work....
> > Just to try what happens I call my program as follow "main //gtcgi"
> > and it enter in one infinite loop...
>
> are your cgi app created with htmllib?
>
> i just add to my apps
> REQUEST HB_GT_CGI
>
> and function gtsys
>
> and on hbmake i change the -gtcrs to -gtcgi
>
> Regards
> Luiz
Ciao Luiz,
thank you for your answer but the problem is that I have no idea how I
should use gtcgi and what I can obtain from it ...
I can access my application using a browse ? I have to use an http
server ?
May you give to me some short direction or suggest me where to search
for ?
Thank you in advance,
Marco
-
Re: GTCGI how to use ?
Marco
> Ciao Luiz,
> thank you for your answer but the problem is that I have no idea how I
> should use gtcgi and what I can obtain from it ...
> I can access my application using a browse ? I have to use an http
> server ?
when you use gtcgi with htmllib, apps is only acessed via browser
> May you give to me some short direction or suggest me where to search
> for ?
see tests/testcgi folder for example on htmllib
Regards
Luiz
-
Re: GTCGI how to use ?
On 28 Dic, 13:29, "cul...@gmail.com" <cul...@gmail.com> wrote:
> Marco> Ciao Luiz,
> > thank you for your answer but the problem is that I have no idea how I
> > should use gtcgi and what I can obtain from it ...
> > I can access my application using a browse ? I have to use an http
> > server ?
>
> when you use gtcgi with htmllib, apps is only acessed via browser> May you give to me some short direction or suggest me where to search
> > for ?
>
> see tests/testcgi folder for example on htmllib
>
> Regards
> Luiz
Hi Luiz,
that should be fine !
But my programs works like an http server ? I mean... I start the
program on my Linux server and I can access it using address like
http://myserver:8080 (or some other port ?)
I will check in the tests/testcgi.. but I am afraid I will have to do
some more questions...
Thank you
Marco
-
Re: GTCGI how to use ?
Marco
>
> Hi Luiz,
> that should be fine !
> But my programs works like an http server ? I mean... I start the
> program on my Linux server and I can access it using address like
> http://myserver:8080 (or some other port ?)
yes
but on this way
http://myserver:8080/cgi-bin/app.exe?COMMANDS
i´ll try to restore the sample that i have online an post the sample, since
i needed to reinstall all machine, but i didn´t reinstall apache yet
Regards
Luiz
-
Re: GTCGI how to use ?
On 28 Dic, 19:07, "Luiz" <l...@xharbour.com.br> wrote:
> Marco
>
>
>
> > Hi Luiz,
> > that should be fine !
> > But my programs works like an http server ? I mean... I start the
> > program on my Linux server and I can access it using address like
> >http://myserver:8080 (or some other port ?)
>
> yes
> but on this wayhttp://myserver:8080/cgi-bin/app.exe?COMMANDS
>
> i´ll try to restore the sample that i have online an post the sample, since
> i needed to reinstall all machine, but i didn´t reinstall apache yet
>
> Regards
> Luiz
Ciao Luiz, sorry about my questions, but I am starting just now to
understand someting about cgi...
If I understand:
1) using a browser I call my program (or some cgi script that will
call my xharbour program)
2) the program will return an html page having inside link to
following option (other xharbour program) and/or input field (that
will be passed like parameters)
3) the user will click or will fill the gets : at the end the page
will be trasmitted back to the web server that will call the
subsequent step ...
....
and so on ...
Is that the philosophy ?
Or there is some other mechanism in order to manage html page ?
Regards, Marco.
-
Re: GTCGI how to use ?
marco.iveco@gmail.com ha scritto:
> On 28 Dic, 19:07, "Luiz" <l...@xharbour.com.br> wrote:
>> Marco
>>
>>
>>
>>> Hi Luiz,
>>> that should be fine !
>>> But my programs works like an http server ? I mean... I start the
>>> program on my Linux server and I can access it using address like
>>> http://myserver:8080 (or some other port ?)
>> yes
>> but on this wayhttp://myserver:8080/cgi-bin/app.exe?COMMANDS
>>
>> i´ll try to restore the sample that i have online an post the sample, since
>> i needed to reinstall all machine, but i didn´t reinstall apache yet
>>
>> Regards
>> Luiz
>
> Ciao Luiz, sorry about my questions, but I am starting just now to
> understand someting about cgi...
>
> If I understand:
>
> 1) using a browser I call my program (or some cgi script that will
> call my xharbour program)
> 2) the program will return an html page having inside link to
> following option (other xharbour program) and/or input field (that
> will be passed like parameters)
> 3) the user will click or will fill the gets : at the end the page
> will be trasmitted back to the web server that will call the
> subsequent step ...
> ....
> and so on ...
>
> Is that the philosophy ?
> Or there is some other mechanism in order to manage html page ?
>
> Regards, Marco.
Hi Marco,
Visto il tuo cognome mi prendo la libertà di scriverti in italiano.
Allora ti occorre Apache o equivalente sotto Linux, poi compili il tuo
programma tenendo presente che il suo output sono le pagine HTML che il
browser dovrà visualizzare.
Quindi piazzi il programma, che avrai compilato con una cosa tipo
hbmk -gtcgi myapp, nella dir cgi-bin di apache (in /var/run/httpd nella
mia slackware) e questo dovrebbe bastare: apache non richiede nessuna
configurazione particolare nella mia distro. Eventualmente devi
abilitare l'esecuzione di cgi dalla dir cgi-bin, insomma la
configurazione di Apache non dovrebbe essere niente di particolare.
Tornando al tuo programma, puoi cominciare con una cosa semplice, tipo:
OUTSTD "<html><body>la mia prima cgi!</body></html"+CHR(10)+CHR(13)
quit
Nel browser adesso digiti come indirizzo: http://<tuocomputer>/cgi-bin/myapp
e dovresti vedere appunto la fatidica frase comparire.
Tieni presente che non puoi usare @ say... etc perché devi emettere come
output solo stringhe di testo seguite da LF e CR, quindi puoi definirti
per comodità un comando CGIOUT cosi':
#command cgiout [<xList,...>];
=> ;
([OutStd(<xList>),] OutStd(Chr(13)+chr(10)))
da usare per l'output.
Anche comodo è avere funzioni standard per l'inizio e la fine delle
pagine HTML, per esempio:
////////////////////////////////
static function MakeHTMLHeader()
////////////////////////////////
cgiout "Content-type: text/html"
cgiout "<HTML>"
cgiout "<BODY>"
return nil
////////////////////////////////
static function MakeHTMLBottom()
////////////////////////////////
cgiout "</body>"
cgiout "</html>"
return nil
Se vuoi che l'utente possa interagire inserisci nelle pagine dei form e
dei bottoni e i relativi effetti. In questo caso ci sono alcune
particolarità e il tuo programma diventerà rapidamente mooolto
complicato. Ho scritto dei programmi che generano con questa tecnica
pagine HTML che contengono centinaia di righe di Javascript che a loro
volta creano pagine dinamiche, praticamente non ci sono limiti al mal di
testa che ti puoi far venire.
Adesso buon divertimento!
Dan
ENGLISH VERSION
Well, I told him something about a simple cgi program to output "my
first cgi" to a browser. I will translate in English if someone is
interested... :-)
-
Re: GTCGI how to use ?
On 2 Gen, 17:39, "D.Campagna" <ynnadre...@tiscalinet.it> wrote:
> marco.iv...@gmail.com ha scritto:
>
>
>
> > On 28 Dic, 19:07, "Luiz" <l...@xharbour.com.br> wrote:
> >> Marco
>
> >>> Hi Luiz,
> >>> that should be fine !
> >>> But my programs works like an http server ? I mean... I start the
> >>> program on my Linux server and I can access it using address like
> >>>http://myserver:8080(or some other port ?)
> >> yes
> >> but on this wayhttp://myserver:8080/cgi-bin/app.exe?COMMANDS
>
> >> i´ll try to restore the sample that i have online an post the sample,since
> >> i needed to reinstall all machine, but i didn´t reinstall apache yet
>
> >> Regards
> >> Luiz
>
> > Ciao Luiz, sorry about my questions, but I am starting just now to
> > understand someting about cgi...
>
> > If I understand:
>
> > 1) using a browser I call my program (or some cgi script that will
> > call my xharbour program)
> > 2) the program will return an html page having inside link to
> > following option (other xharbour program) and/or input field (that
> > will be passed like parameters)
> > 3) the user will click or will fill the gets : at the end the page
> > will be trasmitted back to the web server that will call the
> > subsequent step ...
> > ....
> > and so on ...
>
> > Is that the philosophy ?
> > Or there is some other mechanism in order to manage html page ?
>
> > Regards, Marco.
>
> Hi Marco,
> Visto il tuo cognome mi prendo la libertà di scriverti in italiano.
> Allora ti occorre Apache o equivalente sotto Linux, poi compili il tuo
> programma tenendo presente che il suo output sono le pagine HTML che il
> browser dovrà visualizzare.
> Quindi piazzi il programma, che avrai compilato con una cosa tipo
> hbmk -gtcgi myapp, nella dir cgi-bin di apache (in /var/run/httpd nella
> mia slackware) e questo dovrebbe bastare: apache non richiede nessuna
> configurazione particolare nella mia distro. Eventualmente devi
> abilitare l'esecuzione di cgi dalla dir cgi-bin, insomma la
> configurazione di Apache non dovrebbe essere niente di particolare.
> Tornando al tuo programma, puoi cominciare con una cosa semplice, tipo:
> OUTSTD "<html><body>la mia prima cgi!</body></html"+CHR(10)+CHR(13)
> quit
> Nel browser adesso digiti come indirizzo: http://<tuocomputer>/cgi-bin/myapp
> e dovresti vedere appunto la fatidica frase comparire.
> Tieni presente che non puoi usare @ say... etc perché devi emettere come
> output solo stringhe di testo seguite da LF e CR, quindi puoi definirti
> per comodità un comando CGIOUT cosi':
> #command cgiout [<xList,...>];
> => ;
> ([OutStd(<xList>),] OutStd(Chr(13)+chr(10)))
> da usare per l'output.
> Anche comodo è avere funzioni standard per l'inizio e la fine delle
> pagine HTML, per esempio:
> ////////////////////////////////
> static function MakeHTMLHeader()
> ////////////////////////////////
> cgiout "Content-type: text/html"
> cgiout "<HTML>"
> cgiout "<BODY>"
> return nil
>
> ////////////////////////////////
> static function MakeHTMLBottom()
> ////////////////////////////////
> cgiout "</body>"
> cgiout "</html>"
> return nil
>
> Se vuoi che l'utente possa interagire inserisci nelle pagine dei form e
> dei bottoni e i relativi effetti. In questo caso ci sono alcune
> particolarità e il tuo programma diventerà rapidamente mooolto
> complicato. Ho scritto dei programmi che generano con questa tecnica
> pagine HTML che contengono centinaia di righe di Javascript che a loro
> volta creano pagine dinamiche, praticamente non ci sono limiti al mal di
> testa che ti puoi far venire.
> Adesso buon divertimento!
> Dan
> ENGLISH VERSION
> Well, I told him something about a simple cgi program to output "my
> first cgi" to a browser. I will translate in English if someone is
> interested... :-)- Nascondi testo tra virgolette -
>
> - Mostra testo tra virgolette -
Ciao,
grazie molte della spiegazione, era quello che immaginavo... quindi
diciamo che la cosa diventa piuttosto complicata.
Ogni volta che una nuova pagina html deve essere visualizzata, il
programma che la genera deve terminare, poi la pagina con i suoi
controlli, generera' una nuova chiamata ad un'altro programma (o allo
stesso) passando i valori degli evenualy campi digitati (dopo il punto
interrogativo...).
La mia curiosita' e':
Un programma che si sta eseguendo (chiamato dal browser come tu mi hai
detto) puo' generare una pagina html e poi mettersi in attesa di un
eventuale "risposta" ?
Voglio dire, quando l'utente per esempio compila dei campi di input e
poi diciamo che conferma ("cliccando" su un bottone che chiama qualche
programma nella directory cgi-bin), il programma puo' verificare cosa
e' stato fatto ?
Marco
-
Re: GTCGI how to use ?
<marco.iveco@gmail.com> ha scritto nel messaggio
news:14291501-e52e-41d3-a0ac-a2d1a7c82f53@i29g2000prf.googlegroups.com...
> La mia curiosita' e':
> Un programma che si sta eseguendo (chiamato dal browser come tu mi hai
> detto) puo' generare una pagina html e poi mettersi in attesa di un
> eventuale "risposta" ?
Sì, con i classici XMLHttpRequest oppure Microsoft.XMLHTTP a seconda della
piattaforma. Su Internet trovi tantissimi esempi.
> Voglio dire, quando l'utente per esempio compila dei campi di input e
> poi diciamo che conferma ("cliccando" su un bottone che chiama qualche
> programma nella directory cgi-bin), il programma puo' verificare cosa
> e' stato fatto ?
Il programma chiamato può semplicemente controllare i campi della form che
gli arrivano tramite lo standard input come parametri e magari
all'occorrenza richiamare la pagina con gli oppurtuni parametri. Un bel
casino comunque.
EMG
--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg
The EMG Music page: http://www.emagsoftware.it/emgmusic