I want to send parameters to a cgi using a POST command. How do I do this? I need to have the ability to send moderately large chunks of text to a database. The tutorials are pretty clear on acquiring data from a database, but creating http requests using GET is not going to allow me to send enough text unless I get complex with breaking it up into smaller chunks. POST would be much simpler.
I see a number of postings that refer to POST "xxxxx" to URL, etc, etc. Where is the POST command documented. I'm interested in using it in livecode scripts.
Implementing POST command to cgi
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Implementing POST command to cgi
Bill Prothero
Re: Implementing POST command to cgi
open the docs, type in "post" in the search field in the top right, click the entry.. or http://docs.runrev.com/Command/post
Re: Implementing POST command to cgi
Look up libUrlMultipartFormData.
The sample in there is exactly how I do it.
Ah "...to a database..." maybe not.
Simon
The sample in there is exactly how I do it.
Ah "...to a database..." maybe not.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Implementing POST command to cgi
In my DropBox library, freely available HERE, you can see the POST statement in use for a Content-Type: "multipart/form-data" (see the phx_DropboxWriteFile function) ...waprothero wrote:.... Where is the POST command documented. I'm interested in using it in livecode scripts.
... maybe can help

Guglielmo
-
- Posts: 38
- Joined: Tue Sep 20, 2011 5:01 pm
- Contact:
Re: Implementing POST command to cgi
Actually, this turns out to be pretty easy. Do you see any problems with this?
on mouseUp
put "name" into key_1
put "BillyBoy" into value_1
put "name2" into key_2
put "John Person" into value_2
get libUrlFormData(key_1,value_1,key_2,value_2)
post it to url "http://myURL/lcp/testPost.php"
answer it
end mouseUp
-----------------------------------------
the php script is, for the test:
<?php
echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!' . "\n";
echo 'Hello again: ' . htmlspecialchars($_POST["name2"]) . '!' . "\n";
echo 'Got to test';
?>
Now all I've got to do is use my php to access the database and echo back the resuilts in nice xml.
I'll need a progress bar, of course.
on mouseUp
put "name" into key_1
put "BillyBoy" into value_1
put "name2" into key_2
put "John Person" into value_2
get libUrlFormData(key_1,value_1,key_2,value_2)
post it to url "http://myURL/lcp/testPost.php"
answer it
end mouseUp
-----------------------------------------
the php script is, for the test:
<?php
echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!' . "\n";
echo 'Hello again: ' . htmlspecialchars($_POST["name2"]) . '!' . "\n";
echo 'Got to test';
?>
Now all I've got to do is use my php to access the database and echo back the resuilts in nice xml.
I'll need a progress bar, of course.
Bill Prothero