Sending a POST string

William Prothero prothero at earthednet.org
Fri Aug 7 16:09:37 EDT 2015


For Roger Eller:
Here is what I use. I post to a php script. I’ll share the php, but it should work for livecode servers too. If anybody wants the scripts, contact me off the list.
Best,
Bill

--The data are returned in an array.
--  dRet[i][columnName] holds the value of the data for a particular column
-- calling: specify the table name and the queryOption
--Leave column parameters unset if the added condition is not required.
function db_queryDBTable theTable,queryOption,col1Name,col1Contents,col2Name,col2Contents
   --form the query
   put "theQuery" into key_1
   switch queryOption
      case "all"
         put "select * from "&theTable into value_1
         break
      case "row"
         put "select * from "&theTable&" WHERE "&col1Name&"='"&col1Contents&"'" into value_1
         if col2Name <> "" then
            put " AND "&col2Name&"='"&col2Contents&"'" after value_1
         end if
         break
   end switch
   put "outOption" into key_2
   put "xml" into value_2
   get libUrlFormData(key_1,value_1,key_2,value_2)
   --post the query
—the php script is in a folder scgi-bin. 
   post it to url "http://mywebsite.org/scgi-bin/dbGeneralQueryXML.php?"
   put URLDecode(it) into theXML
—this is my own XML parsing routine.
   put db_parseXMLFromQuery(theXML) into theDataArray
   return theDataArray
end db_queryDBTable

> On Aug 7, 2015, at 10:14 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> 
> put "name1=value1&name2=value2&name3=value3" into tPost
> post tPost to URL <whatever.Url.com>
> 
> Its also handy to use liburlformdata to build your post string
> also liburlmultipartformdata and liburlmultipartformaddpart
> 
> On Fri, Aug 7, 2015 at 10:56 AM, Roger Eller <roger.e.eller at sealedair.com>
> wrote:
> 
>> I want to try POST, but I don't know how to feed it my list as a parameter
>> without having a form involved.  Any examples of POST without a html form
>> would be helpful.
>> 
>> ~Roger
>> 
>> 
>> On Thu, Aug 6, 2015 at 2:38 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>> 
>>> Not sure it'll make a difference, but have you considered using POST
>> rather
>>> than get?
>>> 
>>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list