• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CGI?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGI?


  • Subject: Re: CGI?
  • From: cris <email@hidden>
  • Date: Fri, 13 Apr 2001 20:13:02 +0200

on 13.04.2001 2:12 Uhr, Michelle Steiner at email@hidden wrote:

> On 4/12/01 3:31 PM, cris <email@hidden> wrote:
>
>> Open the standard additions and look at the 'handle CGI request' under
>> 'Internet suite'.
>>
>> If you just want to have a counter you can ignore all the optional
>> parameters and just put your script code into the handler.
>
> Like this:
>
> on handle CGI request
> set FileID to open for access file "dora:counter" with write permission
> if (get eof FileID) is not 0 then
> set NumberOfAccess to read FileID
> else
> set NumberOfAccess to 0
> end if
> set NumberOfAccess to NumberOfAccess + 1
> set eof FileID to 0
> write (NumberOfAccess as text) to FileID
> close access FileID
> return NumberOfAccess
> end handle CGI request

Yes, but you need to change the return statement to:
return http_OK_header & myStaticPagePart1 & myCounterValue &
myStaticPagePart2

If you don't provide the response type to the webserver i guess it will just
end in an error.


> Where does it get saved, though? In a script file, in the html page?
In a stay-open script which name ends with ".acgi" so it is recognized by
the webserver as a executable CGI application.


> If
> the former, how do I access it from the page?
http://yourIPAddress/cgi-bin/myCounterScript.acgi

Where the name of the "cgi-bin" folder can vary from server to server..
"cgi-bin" is the name of the Webstar CGI folder.


>> At the end of the handler you have to return back something to the webserver
>> (which will pass it to the browser). You need to specify the type of
>> response in the header. In this case it will be a '200 OK' which looks so:
>>
>> property CRLF : (ASCII character 13) & (ASCII character 10)
>> property http_OK_header : "HTTP/1.0 200 OK" & CRLF & "Server: MacHTTP" &
>> CRLF & "MIME-Version: 1.0" & CRLF & "Content-type: text/html" & CRLF & CRLF
>
> This goes in the header of the HTML page?
Yes, the HTML page created within your CGI, passed to the webserver which
will send it to the browser.


> What would I use for "server:
> MacHTTP" for personal web sharing instead of the MacHTTP server?
I think you can let it just unchanged.


>> The full response would then look so:
>> return http_OK_header & myStaticPagePart1 & myCounterValue &
>> myStaticPagePart2
>
> Where does this go?
At the end of the 'handle CGI request' handler.



Greetings
cris :-)
--
English is my second language.
www.cooc.de


References: 
 >Re: CGI? (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: CGIs with MacOS 9.1 - problem
  • Next by Date: RE: Passing params to network script object-HELP!
  • Previous by thread: Re: CGI?
  • Next by thread: Re: CGI?
  • Index(es):
    • Date
    • Thread