Lingo Dictionary > O-R > postNetText |  |

postNetText

Syntax

    postNetText(url, propertyList {,serverOSString} {,serverCharSetString})
    postNetText(url, postText {,serverOSString} {,serverCharSetString})

Description

Command; sends a `POST` request to `url`, which is an HTTP URL, with `postText` as the data.

This command is similar to `getNetText()`. As with `getNetText()`, the server's response is returned by `netTextResult(``netID``)` once `netDone(``netID``)` becomes 1, and if `netError(``netID``)` is 0, or OK.

When a property list is used instead of a string, the information is sent in the same way a browser posts an HTML form, with `METHOD=POST`. This facilitates the construction and posting of form data within a Director title. Property names correspond to HTML form field names and property values to field values.

The property list can use either strings or symbols as the property names. If a symbol is used, it is automatically converted to a string without the # at the beginning. Similarly, a numeric value is converted to a string when used as the value of a property.

Note: If a program uses the alternate form—a string instead of property list—the string postText is sent to the server as an HTTP POST request using MIME type "text/plain." This will be convenient for some applications, but is not compatible with HTML forms posting.

The optional parameter `serverOSString` defaults to `UNIX` but may be set to `Windows` or `Mac` and`` translates any carriage returns in the `postText` argument into those used on the server to avoid confusion. For most applications, this setting is unnecessary because line breaks are usually not used in form responses.

The optional parameter `serverCharSetString` applies only if the user is running on a Shift-JIS (Japanese) system. Its possible settings are `"JIS"`, `"EUC"`, `"ASCII"`, and `"AUTO"`. Posted data is converted from Shift-JIS to the named character set. Returned data is handled exactly as by `getNetText()` (converted from the named character set to Shift-JIS). If you use `"AUTO"`, the posted data from the local character set is not translated; the results sent back by the server are translated as they are for `getNetText()`. `"ASCII"` is the default if `serverCharSetString` is omitted. `"ASCII"` provides no translation for posting or results.

The optional arguments may be omitted without regard to position.

This command also has an additional advantage over `getNetText()`: a `postNetText()` query can be arbitrarily long, whereas the `getNetText()` query is limited to the length of a URL (1K or 4K, depending on the browser).

Executing any network Lingo operations concurrently with a Shockwave Audio (SWA) stream can cause interruptions in the playback of the SWA stream.

Note: If you use `postNetText` to post data to a domain different from the one the movie is playing from, the movie will display a security alert when playing back in Shockwave.

To see an example of `postNetText` used in a completed movie, see the Forms and Post movie in the Learning\Lingo Examples folder inside the Director application folder.

Example

This statement omits the `serverCharSetString` parameter:

    netID = postNetText("www.mydomain.com\database.cgi", "Bill Jones", "Win")

Example

This example generates a form from user-entry fields for first and last name, along with a Score. Note that both `serverOSString` and `serverCharSetString` have been omitted:

    lastName = member("Last Name").text
    firstName = member("First Name").text
    totalScore = member("Current Score").text
    infoList = ["FName":firstName, "LName":lastName, "Score":totalScore]
    netID = postNetText("www.mydomain.com\userbase.cgi", infoList)

See also

`getNetText()`, `netTextResult()`, `netDone()`,`netError()`