Problem with AppleScript cgi

I’m trying to get an AppleScript cgi running and I am using the sample Apple provides on its website. (http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.12.htm)

The only difference is that I changed test.cgi to test.acgi. I have acgi dispatcher running (version 1.1) and I have web sharing on. When I click the submit button on the form I get the following error message:

The requested URL /CGI-Executables/test.acgi was not found on this server.

I stuck the cgi script in this folder because it seemed like a logical place to store it. But I also got the same results when I dump it in the Web Server/Documents folder as well.

I’ve established that I am doing something wrong, just not sure what. (Story of my life). Any help would be appreciated, speak slowly though as I am a newbie when it comes to cgi stuff.

Thanks

Hi,

I’ve tried the same thing as you and never got it to work. Maybe you can get it to work after reading this article:

http://www.macdevcenter.com/pub/a/mac/2001/12/14/apache_two.html

I must have read this article like 10 times.

gl,

acgi dispatcher works fine on my machine. Perhaps you are getting confused by the fact you install the CGIs in the “CGI-Executables” folder but that the URL to that folder from the webserver (Apache) is “cgi-bin”.

To get it to work, install Dispatcher & your AS CGIs in “/Library/WebServer/CGI-Executables”. Double-click Dispatcher, enter your password to update “/private/etc/httpd/httpd.conf” to include this line “Include /Library/WebServer/CGI-Executables/dispatcher.app/Contents/acgi.conf” and restart websharing. Then add this file to your CGI-Executables folder (save as an application with the name “text.acgi”):

property my_path : ""
property crlf : (ASCII character 13) & (ASCII character 10)
property http_header : "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
property CurrentFormData : {}

on handle CGI request path_args searching for http_search_args executing by the_link given «class TraL»:NewFormData
	set my_path to the_link
	set CurrentFormData to NewFormData as list
	set the_text to GetFormData("the_text")
	set return_page to http_header & "
<html>
<head>
    <title>ACGI Test Results</title>
</head>
<body>
The text submitted was: " & the_text & "<br>
My path: " & my_path & "
</body>
</html>"
	
	return return_page
end handle CGI request

on GetFormData(theKey)
	set thisCount to length of CurrentFormData
	repeat with i from 1 to thisCount
		set tempList to item i of CurrentFormData
		if item 1 of tempList is theKey then return item 2 of tempList
	end repeat
	return ""
end GetFormData

Next, make an HTML file named “cgi_test.html” placed in the root of your main webserver folder and include this text:

<html>
<head>
<title>CGI Test</title>
</head>
<body>
<form action="../cgi-bin/test.acgi" method="post">
<textarea name="the_text" rows="10" cols="40">
</textarea>
<button type="submit">Submit</button>
</form>
</body>
</html>

Finally, load the page:

[url=http://127.0.0.1/cgi_test.html]http://127.0.0.1/cgi_test.html[/url]

Enter some text in the text field and submit. As I said, it works like a charm for me here on 10.3.2 including all of the latest security updates.

Jon

I get a nilObjectExceptionError from acgi dispatcher. (I’m only using the demo version). I couldn’t find where to do the setups you posted.