posturl(
posturl(
URL
,
DICTIONARY
,
TIMEOUT
,
CACHEPOLICY
)

The posturl( function loads a resource from the internet, with form data.

Parameters

This function has four parameters:

url – The address of the resource to be loaded, for example `"http://www.apple.com"`.

dictionary – Dictionary of keys and values to be submitted to the server.

timeout – The maximum number of seconds to wait for a response from the server. This parameter is optional, if omitted, the default timeout is 60 seconds.

cachepolicy – The cache policy to use for loading this resource. This parameter is optional, if omitted, the default cache policy will be used (0). If you want to ignore the cache and always go to the server, set the cache policy to 1. If you want to get hardcore and find out about other options, google `NSURLRequestCachePolicy`. For almost all operations, the default policy is the way to go.

Description

This function loads a resource from the internet using HTTP POST (to make a HTTP GET request use the loadurl( function). In addition to the url itself, you can use a dictionary to supply one or more post arguments. These allow you to post data that would normally be supplied by an HTML form. In this example, two values are posted, Name and Email.

    displaydata posturl("http://www.somesite.com/register",
        initializedictionary("Name","John Smith","Email","jsmith@xyzmail.com"))

This function returns whatever data the server responds with, usually HTML text.

Note: The url function can perform the exact same operation as the posturl( function, but with more flexible options. We recommend using the url function for new code.

Note: The posturl( function is synchronous. This means that Panorama stops in its tracks until the communication is complete, so you should avoid this function if possible and use urltask( instead.

See Also

- encodehttppostdata( -- converts a dictionary into HTTP post data.
- info("httpheaders") -- returns a dictionary with information about a just completed HTTP download.
- info("urltaskinfo") -- returns information about a just completed HTTP download.
- ipaddress -- returns the current IP address of the computer, or "" if not connected.
- loadurl -- loads a resource from the internet.
- loadurl( -- loads a resource from the internet.
- posturl -- loads a resource from the internet, with form data.
- url( -- synchronously loads a resource from the internet.
- urltask( -- asynchronously loads a resource from the internet.
- urltaskcancel -- aborts a download initiated with the urltask( function.
- urltaskstatus -- enables connection error checking in urltask( completion code.
- zipinfo -- queries the web to obtain information about a zip code.
- zipinfoplus -- queries the web to obtain information about a zip code.

History

Version | Status | Notes
10.0 | New | New in this version (though of course previous versions had a statement to do this, which is still available).