Error getting tags :
error 404Error getting tags :
error 404 http | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
http
Basics
Expander triangle
Type
Keyword
Syntax
Introduced
1.0
Changed
1.1.1
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
Network
Summary
Used as a URL type with such commands as put and get to designate a file on the World Wide Web.
Examples

set the htmlText of field 1 to URL "http://example.org/data.html"
put URL "http://www.example.com/output?this=that" into testData
put line 2 of URL "http://www.example.com/stuff/" into testDate

Additional Comments
Expander triangle

Use the http keyword to work with files on the Web.

Comments:

The URL scheme "http" indicates information located on a web server. An http URL consists of:

1. The string "http://"

2. An optional user name and password, separated by a colon (:) and followed by "@"

3. The name of the server (for instance, "example.net") followed by a slash

4. The location of the resource (often, a file path).

Here are some examples of valid http URLs:

http://www.example.com

The main page for the server "www.example.com"

http://www.example.com/directory/

A directory on the server

http://www.example.com/directory/file.html

A file on the server

http://user:password@www.example.com/file.txt

A file accessed by a user name and password

http://www.example.com/directory/stuff.html?list=yes

A page generated by a query--possibly generated by a CGI

Important! If your user name or password contains any of the characters ":", "@", "/", ".", or "|", use the URLEncodefunction to safely encode the user name or password before putting them into the URL. The following example constructs a URL for a user whose password contains the "@" character:

put "name" into userName

put "jdoe@example.com" into userPassword

put "http://" & userName & ":" & URLEncode(userPassword) \

& "@www.example.net/index.html" into fileURLToGet

get URL fileURLToGet

An http URL is a container, and you can use the expression URL httpURL in any statement where any other container type is used. When you get the value of an http URL, Revolution downloads the URL from the server. (If you have previously cached the URL with the load command, it fetches the URL from the cache.)

If an error occurs during transfer of the data, the error is placed in the result function. The first word returned by the result function is "error", followed (where appropriate) by the text of the error message returned by the HTTP server, including the server response code.

Important! If there is an error downloading an httpURL, the URLcontainer does not necessarily evaluate to empty. Most HTTPservers send an error page when the file is not found or another error occurs, and the URL container will evaluate to the contents of this page. Before using the data in a URL container, check the result to make sure it is empty and there was no error.

You can upload data to a web server by putting a value into an http URL, as in the following statement:

put field "Info" into URL "http://www.example.net/info.html"

However, because most web servers do not allow HTTP uploads, the attempt usually will not be successful. (Check with the server's administrator to find out how and where to upload files.)

Note: Transferring a URL by using it in an expression is a blocking operation: that is, the handler pauses until Revolution is finished getting the URL. Since contacting a server may take some time due to network lag, URL operations may take long enough to be noticeable to the user.

Important! If a blocking operation involving a URL (using the putcommand to upload a URL, the postcommand, the delete URLcommand, or a statement that gets an ftp or HTTPURL) is going on, no other blockingURL operation can start until the previous one is finished. If you attempt to use a URL in an expression, or put data into a URL, while another blockingURL operation is in progress, the result is set to "Error Previous request not completed".

Downloading a URL does not prevent other messages from being sent during the download: the current handler is blocked during the download, but other handlers are not. This means that if, for example, your application has a button that downloads a URL, the user might click the button again (or click another button that downloads another URL) while the first URL is still being downloaded. In this case, the second download is not performed and the result is set to "error Previous request has not completed." To avoid this problem, you can set a flag while a URL is being downloaded, and check that flag when trying to download URLs to make sure that there is not already a current download in progress.

The following example shows how to set a flag in a global variable to prevent multiple downloads. The variable "downloadInProgress" is set to true while a download is going on, and back to false when the download concludes. If the user clicks the button again while the download is still going on, the handler simply beeps:

on mouseUp

global downloadInProgress

if downloadInProgress then

beep

exit mouseUp

end if

put true into downloadInProgress -- about to start

put URL (field "Page to get") into field "Command Result"

put false into downloadInProgress -- finished

end mouseUp

For technical information about URLs and the http URL scheme, see RFC 1630 at <http://www.ietf.org/rfc/rfc1630.txt>.

Important! The httpkeyword is part of the Internet library. To ensure that the keyword works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions section of the Standalone Application Settings window, make sure "Internet Library" is selected in the list of script libraries.

Note: When included in a standalone application, the Internet library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the httpkeyword is not yet available. This may affect attempts to use this keyword in startup, preOpenStack, openStack, or preOpenCardhandlers in the main stack. Once the application has finished starting up, the library is available and the httpkeyword can be used in any handler.

Changes to Revolution:

The http keyword was moved to the Internet library in version 1.1. In previous versions, this functionality was part of the engine.

The ability to use authenticated http URLs (with a user name and password) was introduced in version 1.1.1.

User Comments
Expander triangle