Re: CGI posts- new to AS
Re: CGI posts- new to AS
- Subject: Re: CGI posts- new to AS
- From: email@hidden
- Date: Sun, 30 Sep 2001 14:22:28 EDT
You've taken on quite a challenge for a newbie. Here are some starter CGI
tips:
http://www.linkedresources.com/teach/applescript/writingCGIs.html
get Tanaka's osax (version 2.01 or better - very imprtant CGI bug fix) for
parsing and packing post_args.
URL Access scripting will allow you to post CGI data, but the session
management/security stuff might be tricky.
Do not use Applescript 1.6 with CGIs; Version 1.7 for classic should be out
"any day now," or use 1.5.5 (comes with the standard 9.1 install).
More later, no time now.
Jeff Baumann
email@hidden
www.linkedresources.com
cc please, on digest
In a message dated 9/30/01 12:05:48 PM, higherpowered wrote:
>
Hi all-
>
>
I'm just figuring this stuff out as I go along :)
>
>
I need to write a cgi script to connect with PayPal. I have the part to
>
grab the post data written, although I know there is a better way. I'm not
>
exactly sure why i've done it this way, but it seems to work. I didn't know
>
how to tell AS to loop through all the pairs and create them in the script
>
rather than me listing them manually (below is just a portion of the info
>
gathered).
>
>
>
set invoice to goOffsetInList(myArgList, "invoice")
>
set custom to goOffsetInList(myArgList, "custom")
>
set payment_status to goOffsetInList(myArgList, "payment_status")
>
set pending_reason to goOffsetInList(myArgList, "pending_reason")
>
set payment_date to goOffsetInList(myArgList, "payment_date")
>
set payment_gross to goOffsetInList(myArgList, "payment_gross")
>
set payment_fee to goOffsetInList(myArgList, "payment_fee")
>
set txn_id to goOffsetInList(myArgList, "txn_id")
>
>
what I need to do now is post this info back to another URL, along with one
>
or two more bits of info. I've got this part(below), and know how I can
>
return the info into a web page using the "Your Payment Status " &
>
payment_status & "" within the body tags, but not sure how to set it as a
>
post and return it to a URL. Also, as i mentioned above, is there a way to
>
grab the name/value pairs from the post and loop them rather than hard
>
coding above and below to send the post again. This way if a name/value
>
changes, I do not have to re-write the script (not to mention the excess
>
script size)
>
>
set crlf to (ASCII character 13) & (ASCII character 10)
>
set myHTML to "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP/2.0" & crlf &
>
"MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
>
set myHTML to myHTML & ""
>
return myHTML
>
>
any help is greatly appreciated. I wrote my first script a few weeks ago to
>
interface between the web and our mail server, and am hooked!
>
>
Jim Sheffer
>
http://www.integraserve.net
>
email@hidden
>
253-638-3287
>
"Get paid to host your sites!"