Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Function to decode POST

From: gjones05:mail:orion at: 9-Apr-2001 9:49

From: "Rondon Andrade"
> Does anybody has a function do decode post ? I've seen just to decode > cgi-query-string.
Hi, Rondo, I have several approaches that I've used. One of these does not work with older versions of REBOL, but I can't seem to remember which right now. The second example demonstrates that making an object out of the return makes it a bit easier to retrieve results using path notation. The example itself merely prints out the forms fields and results for you perusal. Example #1: #!c:/program files/rebol/rebol -cs REBOL [] retrieve-user-data: func [] [ return decode-cgi either system/options/cgi/request-method = "POST" [ data: make string! 2002 foreach line copy system/ports/input [ repend data [line newline] ] ][ either system/options/cgi/query-string [ system/options/cgi/query-string ][ "" ] ] ] print "Content-Type: text/html^/" print [ <HTML><BODY> {Here is the posted data.} <HR><PRE>(retrieve-user-data)</PRE> </BODY></HTML> ] Example #2: #!c:/program files/rebol/rebol -cs REBOL [] retrieve-user-data: func [] [ return decode-cgi either system/options/cgi/request-method = "POST" [ input ][ either system/options/cgi/query-string [ system/options/cgi/query-string ][ "" ] ] ] result: make object! retrieve-user-data print "Content-Type: text/html^/" print <HTML><BODY> print {Here is the posted data.} print <HR><PRE>help result</PRE> print </BODY></HTML> Hope this helps. --Scott Jones