Humanities Home page   Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

DigHT 310
"Mining" HTML Source Code
for POST method APIs

The process of duplicating a web form that uses the POST method in your LiveCode stack is very similar to the process for implementing a GET method form. The only real difference is that the argument string submitted using POST is not displayed in the browser's address field after submitting the form data. That means that you have to look at the HTML source for the page containing the form (using the browser's View Page Source function) and find the name=value pairs that need to be submitted by the form.

Since the steps for duplicating a POST form are very similar to those for duplicating a GET form, this list will note the main steps only; the details can be found in the instructions for GET forms. As with GET forms, your whole task in your LiveCode stack is to exactly duplicate the arglist from the web site.

  1. Find a web form whose functionality you would like to implement in LiveCode.

  2. Duplicate the form in your LiveCode stack by building the interface with all of the control objects you need.

  3. Open the HTML source code for the page containing the form and find the <form> tag.

  4. Find the name=value pairs needed for the POST data, as described in the document on Understanding GET and POST Methods in HTML Forms.

  5. Build your arglist from the elements in your stack's form. You should end up with a string something like this: fullname=Janet+Planet&gender=female&color=red

  6. To submit your form data to the host server, use the LiveCode post command. Post results go into the it variable:

      put urlEncode(fld "fullname") into tName
      put the hilitedButtonName of group "genderGrp" into tGndr
      put urlEncode(the label of btn "colorChoice") into tColor
      put fullname=" & tName & "&gender=" & tGndr & "&color=" & tColor into tArgList
      post tArgList to URL ""
      put it into tFormResults
  7. As with the GET example, now all that remains is to parse the desired information out of the returned data.

Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University.
This page last updated on December 02, 2014 14:49:35.