Emulate an HTTP post in Rev

Jim Ault jimaultwins at yahoo.com
Mon Dec 28 04:14:53 EST 2009


On Dec 27, 2009, at 8:52 PM, Jim Bufalini wrote:

> Hello,
>
> Can someone tell me how to emulate an HTTP post in Rev for a Revlet or
> Standalone? So... someone gives you an HTML code snippet to insert  
> in a webpage.

The key word is the   POST   command in the dictionary.

Be sure to handle the issue of urlEncode-ing in your strings to avoid  
parsing errors in the destination script operations, especially if  
path names are sent.

Examples:
put urlEncode( "John" ) into  tName
put urlEncode( "Hello" ) into  tMessage
--now do key-value pairs
get libUrlFormData("name", tName,"message", tMessage)
post  IT  to url "http://www.someserver.com/cgi-bin/form.php"

--In this case, the data posted to the url will look like this:  
name=John&message=Hello


The function accepts variable numbers of parameters and treats them as  
key-value pairs. The first parameter is the name of the first form  
part, the second the value of the first part, the third is the name of  
the second part, and so on.

Note: When using 'post' ... the Content-Type header is set to "Content- 
Type: application/x-www-form-urlencoded" by default. There is no need  
to set the httpHeaders unless you have previously set the Content-Type  
header to something else.

In order to fully emulate a post command coming from a web page, you  
may need to set the headers to match by using
      libURLSetCustomHTTPHeaders


Jim Ault
Las Vegas


On Dec 27, 2009, at 8:52 PM, Jim Bufalini wrote:

> Hello,
>
> Can someone tell me how to emulate an HTTP post in Rev for a Revlet or
> Standalone? So... someone gives you an HTML code snippet to insert  
> in a
> webpage. It looks like:
>
> <form action="[URL]" method="post">
> <input type="hidden" name="[abc]" value="[123]">
> <input type="hidden" name="[def]" value="[456]">
> ...
> </form>
>
> I want to use *post* from Rev to emulate their button code. How do I
> structure the "data" string of a Rev Post command to emulate the  
> above? And,
> do I need to change the httpHeaders Property to emulate it coming  
> from a
> webpage?




More information about the Use-livecode mailing list