• 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: Michelle Steiner <email@hidden>
  • Date: Thu, 12 Apr 2001 17:12:56 -0700

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

Where does it get saved, though? In a script file, in the html page? If
the former, how do I access it from the page? if the latter, where in
the page?

>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? What would I use for "server:
MacHTTP" for personal web sharing instead of the MacHTTP server?

>The full response would then look so:
>return http_OK_header & myStaticPagePart1 & myCounterValue &
>myStaticPagePart2

Where does this go?

I just can't figure out any of it right now.

--Michelle

----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------


  • Follow-Ups:
    • Re: CGI?
      • From: cris <email@hidden>
    • Re: CGI?
      • From: Sander Tekelenburg <email@hidden>
  • Prev by Date: path to constants
  • Next by Date: New O'Reilly book on AppleScript
  • Previous by thread: Re: CGI?
  • Next by thread: Re: CGI?
  • Index(es):
    • Date
    • Thread