Is it possible to access environmental variables (i.e., cookie) from a cgi written in Applescript?
Handle CGI Request can capture what I think you are looking for. I use one that determines if the user is on a Mac or PC, what the referring page is, and IP address is.
Here is what the dictionary says:
handle CGI request: Sent to a script to process a Common Gateway Interface request (defined in: Standard Additions)
handle CGI request string – the path of the URL
(searching for string) – the data for the GET method or data after the ‘?’ in a POST method
(with posted data string) – the POST arguments
(of content type string) – the MIME content type of POST arguments
(using access method string) – either ‘GET’ or ‘POST’
(from address string) – the IP address of the entity making the request
(from user string) – the user name associated with the request
(using password string) – the password sent with the request
(with user info string) – additional information about the user, usually the email address
(from server string) – the name of the server application sending this request
(via port string) – the IP port number of the server
(executing by string) – the path to the script executing this CGI, in URL form
(referred by string) – the URL of the page the client used to link to the CGI
(from browser string) – the name of the client software
(using action string) – the path to the file or CGI
(of action type string) – either PREPROCESSOR, POSTPROCESSOR, CGI, or ACGI
(from client IP address string) – the Internet address of the client
(with full request string) – the full request as sent to the server
(with connection ID integer) – the ID of the connection from the server to the client
(from virtual host file specification) – the root folder of the virtual host
Result: web page – An HTML page resulting from the CGI execution
Here is what code for a cgi that captures IP, Referring Page, and Browser Type (& platform)
on handle CGI request searching for Searching_For with posted data postedData from client IP address clientIP with user info userInfo from browser clientBrowser
You would still need to parse the posted arguments to get the data posted.
A couple of the browser types returned in my script look like:
Hope this helps…
But you need a third part software such as CGI enabler (oS X Server) or ACGI Dispatcher, you can make it work direclty with Apache.