HTTP headers for posting data
Dave Cragg
dcragg at lacscentre.co.uk
Tue Jun 10 14:37:01 EDT 2003
At 7:20 pm +0200 10/6/03, Andre Rombauts wrote:
>I want to post data from a RunRev application to a web page that
>will manipulate them.
>Let's say data1, containing "Hello" and data 2 "World"...
>How do I setup the httpHeaders property and the data argument in the
>post instruction?
>Where can I find more info about setting up http headers for
>get/post procedures?
>
>on mouseUp
> put "Hello" into data1
> put "World" into data2
> set the httpHeaders to ???
> post ??? to URL http://www.mysite.org/php/test.php
>end mouseUp
>
>Thanks in adavance to all!
>
>André Rombauts
You'll need to know what form of data the server is expecting. If
you're trying to reproduce something in a web page, you should be
able to look in the html page source and find the various data fields that
are sent with the request.
If it's a typical url form you want to emulate, then the data you
need to post usually looks like this:
"field_1=value&field_2=value&field_3=value"
So if the field names are "data1" and "data2" then you could try
something like this:
put "data1=Hello&data2=World" into tData
post tData to url "htpp://whatever..."
if the result is not empty then
answer the result
else
put it into field "response" ##or whatever
end if
You shouldn't need to set the httpHeaders. By default, the
"Content-Type" header is set to "application/x-www-form-urlencoded"
for post requests.
Cheers
Dave
More information about the use-livecode
mailing list