RE: cgi

new topic     » topic index » view thread      » older message » newer message

Thank you for the function (I'll need to study it more, but I get the 
gist), but I have no open routines, etc.  I fully understand the 
requirements for cgi (spent the last 7 days looking up the specs, etc.). 
 I must not be explaining myself very well (my biggest problem).  My 
program is *only* this:

Filename sendimage.exw
[code]
puts (1, "Location: /IsPlaying.bmp")
[end code]
When bound into a win32 .exe this works.  My bitmap is returned to the 
browser to be displayed.  If I update the bitmap and browse to the URL 
(http://server/cgi-bin/image.exe) the browser updates accordingly, 
instead of displaying the locally cached image, which might not be what 
I want displayed.  It is all working.  I know I have a lot to add, but I 
don't want to do anything else until I solve this problem:  How do I 
prevent the console from opening and closing whenever the browser 
requests the image?

My goal is a program that takes the currently playing song out of Winamp 
and turns it into an image.  This would allow radio stations, and forum 
signatures to display a dynamic image of whatever they are playing at 
the moment to the users.  If the console window opens everytime the 
program runs (could get hunderds of hits an hour), this is a BIG problem 
and there is no point in refining the cgi code into elegance.  I'll just 
have to do it in php or perl, which I'm trying to avoid doing, I want a 
"pure" solution, one that depends on as little third party software as 
possible.  Perhaps a translation to C and compiling that?

Thanks for trying, I really do appreciate it
-=Cassidy=-

rolf.schroeder at desy.de wrote:
> Cassidy Napoli wrote:
> > 
> > ....  So I am guessing tthat there
> > isn't a way to get Euphoria to execute win32 code without a window?
> > 
> You have to write the CGI program without any window (open etc.)
> routines, you need
> puts() as std_out(). Euphoria has no std_in() function. Use the GET
> method instead and read the CGI environment by 'getenv("QUERY_STRING")'.
> If your WWW-CGI server writes the data transferred by POST into a file,
> and if it offers you the file name via the CGI environment you may use
> also the POST method. Attached is a function for the
> XITAMI server to read the data sent to the server server:
> 
>     integer  len, fn    --               -2 = REQUEST_METHOD fails
>                         --               -3 = unknown error
>     method = getenv("QUERY_METHOD")
>     if atom(method) then
>         return -2
>     elsif equal(method,"POST") then
>         s = value(getenv("CONTENT_LENGTH"))
>         if s[1] = GET_SUCCESS then
>             len = s[2]
>             s = "..\\" & getenv("CGI_STDIN")
>             fn = open("..\\..\\" & getenv("CGI_STDIN"),"rb")
> 
>             if fn < 0 then
>                 return "Open failed! " & s
>             end if
>             s = get_bytes(fn,len)
>             close(fn)
>             return s
>         else
>             return s[1]
>         end if
>     elsif equal(method,"GET")  then
>         return getenv("QUERY_STRING")
>     else
>         return -3
>     end if
> end function
> 
> Have a nice day, Rolf
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu