tcp.httpClient

Syntax tcp.httpClient (method, server, port, path, proxy, proxyPort, proxyUserName, proxyPassword, data, datatype, username, password, adrHdrTable, cookiesOn, debug, timeOutTicks, flMessages, ctFollowRedirects, flJustHeaders, flAcceptOpml, flUseProxy)

Params method, a string. is the HTTP method to be used, e.g. "GET" or "POST"

server, a string. is the address of the server, either a domain name or a dotted id, e.g. "www.scripting.com" or "206.204.24.4"

port is a number, usually 80, that the HTTP server is accessed thru

path, a string, is the URL of the file being requested, e.g. "/default.html"

proxy, proxyPort, proxyUserName, proxyPassword, all strings, allow you to talk to a proxy server

data, a string, is the data to be sent in the body of the request

datatype, a string, is the Content-type of the message header

username, password, both strings, allow you to access password-protected pages

adrHdrTable, an address, can contain additional header items for the HTTP request

cookiesOn, a boolean, indicates whether or not you want to exchange a cookie with the server

debug, a boolean, if true, tcp.httpClient will save the request and response in scratchpad.httpCommand and scratchpad.httpResult.

timeOutTicks, a number, is the number of sixtieths of a second before tcp.httpClient will time out

flMessages, a boolean, if true, tcp.httpClient will display progress messages in the About window

ctFollowRedirects, a number defaulting to 0, is the number of HTTP redirects that the script will follow

flJustHeaders, a boolean, if true, tcp.httpClient stops reading the response after getting the headers.

flAcceptOpml, a boolean, if true, tcp.httpClient adds an Accept header with the value: text/x-opml, */*, so a server that would normally render OPML as HTML return the OPML text.

flUseProxy specifies whether or not to use a proxy server. If not specified, then the setting at user.webBrowser.proxy.enabled is used.

Action Does an HTTP client request.

Returns The text of the HTTP response.

Examples wp.newTextObject (tcp.httpClient (server:"www.scripting.com", path:"/98/09/News21.xml"), @scratchpad.xmlText)
Notes All of its parameters are optional, the usual usage is to only specify some of the parameters and label all parameters with their names.

If the server string contains a colon, for example, www.scripting.com:80, we use that port for the HTTP request. If no port is specified by the caller, or is encoded in the server string, we talk to port 80 on the server.

When following redirects, it is recommended that flFollowRedirects is not set to a value higher than 5, since receiving this many redirects usually indicates that the script is stuck in an infinite redirection loop.

This verb is implemented as a script.

The flJustHeaders, flAcceptOpml, and flUseProxy parameters were added in Frontier 8.0.

See Also string.httpResultSplit

Discuss