atomic web server + cgi

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by muab.

heyas =)

i would like to make aws to launch an external app, with the parameter(s) that are entered into the input form...

i allready found some code for the html file:


CGI Example



Parameter






and

ElseIf Left(a$, 4) = "POST" ;; here is extra code ------------------
Repeat
in= FindString(a$,EOL$,0)
If in
Debug Left(a$,in-1)
EndIf
a$=Mid(a$,in+2,Len(a$))
Until in=0
RunProgram("c:\myprog\WWW\cgi\purecgi.exe","",1)

for the server code.

the app is launched, but not with parameters.
(want to integrate some kind of search function)

thx
muaB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

But what is the problem?

The HTM Path should be something like

http://www.mysite.com/cgi-binn/mycgi.ex ... 2&param3=3

Just send as parameter the part of the HTM part that are after the "?" and in your cgi split it.


Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by muab.

well i tried this one:
RunProgram("c:\myprog\WWW\cgi\test.bat","",1)

test.bat:
echo %1 %2 %3
(so it should just give me the params back, but there are no params =((

oh, ic... but i want the input form on my html site to forward what was entered (kinda search engine)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
oh, ic... but i want the input form on my html site to forward what was entered (kinda search engine)
Use forms and POST method from HTML.

Code: Select all

This is my input.



Then the input goes in the paht (like a search engine: http://www.google.com/search?q=yoursearch) and if you do as i said before your cgi will receive it.

It the case of the example it will return:

http://www.yourserver.com/cgi-bin/youre ... +my+input.

In fact if you are coding the server you can handle the data after "?" within your server wth no need to call an external executable.

However it will be almost the same, you need to get the path after the "?", split it and work with in and then return the result as an html page (if this is wath your cgi is going to do!).



Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by muab.

ahhhh, way cool =)

many thx

muaB
Post Reply