The wwHTTP class provides HTTP access via WinInet to Visual FoxPro application. This class provides tight control over most aspects of the HTTP protocol including HTTP headers (client and server side), timeouts, proxy support, authentication as well as providing support for asynchronous HTTP operation.

This class does not require wwIPStuff.dll with the following exceptions:

Based on: Relation
Stored in: wwHTTP.prg

Inheritance


Relation
  wwHttp

Properties, Events and Methods

Member Description
onhttpbufferupdateThis method can be used to display progress information on downloads. It gets called whenever the receive buffer is updated on an HTTPGetEx update.
OnHttpPostConnectThis event fires after the Http connection has been established and can be useful to set specific WinInet options on the HTTP connection.
wwHTTP Utility methodswwHTTP also includes a couple of extra utility methods that are not directly related to HTTP operation. These methods are also found and documented in wwIPStuff:
addpostkeyAdds a POST key and value pair to be used in a POST operation with HTTPGet and HTTPGetEx().
o.AddPostKey(tcKey, tcValue, tlIsFile)
getpostbufferRetrieves the current Post buffer. Post buffer is implemented as a memo field in a cursor.
o.getpostbuffer()
getsystemerrormsgReturns a WinInet or Win32 API error message.
o.getsystemerrormsg(lnErrorNo, llAPI)
httpcanceldownloadCancels an HTTPGetEx download if the buffer is sized dynamically. Used in conjunction with OnHTTPBufferUpdate.
o.httpcanceldownload()
httpcloseCloses an HTTP Session opened with HTTPConnect(). This method is automatically called during DESTROY.
o.httpclose()
httpconnectThis HTTP method initiates a low level HTTP request for use with HTTPGetEx by establishing an IP Session and connecting to a target server. The main purpose of this method is to specify the server name and the security options when connecting.
o.httpconnect(lcServer, lcUsername, lcPassword, llHTTPS)
httpgetRetrieves an HTTP request such as an HTML document or XML data from a Web server using standard URL syntax. Despite its name this method can also POST data to the server.
o.HttpGet(lcUrl, lcUsername, lcPassword, lcOutputFile)
httpgetexThis method is the full featured HTTP access method that provides full support for the HTTP protocol including POST data, Basic Authentication and HTTPS protocol support. Requires HTTPConnect() to open a connection first and HTTPClose() to shut down.
o.HTTPGetEx(tcPage, @tcBuffer, @tnBufferSize, tcHeaders, tcFileName)
HTTPGetExAsyncAllows you to retrieve HTTP content asynchronously and store the result value into a file. Client code can poll for the result file to retrieve the Async content.
o.HTTPGetExAsync(tcPage,tcResultFile,tnResultSize,tcHeaders)
httpgetheaderRetrieves an HTTP header from a URL. Useful for retrieving information about a request prior to actually downloading the full URL. You can spy the content length from the header for example.
o.httpgetheader(tcPage, tcHeaders, tnHeaderSize)
HTTPPingUse this method to 'ping' a Web site that is known to be up to check whether a valid Internet Connection can be made. You can specify a timeout value that determines how long this request runs and waits for finding the site in question.
o.HTTPPing(lnTimeout,lcUrl)
InternetCrackUrlThis method breaks down an incoming URL into its component pieces.
loUrl = o.InternetCrackUrl(lcUrl)
SetOptionSets an Internet option on a given connection handle. The handle can be either an Internet handle or the Http handle so this method has to be called after the connection has been opened. It is meant primarily for internal purposes.
o.SetOption(lnHandle,lnOptionId,lnOptionValue)
WinInetSetTimeoutAllows setting the timeout period for an HTTP request. The timeout is specified in seconds and controls how long a Connect, Read or Send operation waits before being considered timed out.
o.wininetsettimeout(dwTimeoutSecs)
cerrormsgLast Error Message Text for the last operation. Implemented only for SMTP and HTTP operations.
cExtraHeadersAllows you to specify extra HTTP or SMTP headers when sending requests to Web Servers or SMTP serveres.
chttpheadersThis property is set when calling HTTPGetEx and contains the entire HTTP header of a request. This property is a result property only after an HTTP request completes. Use cExtraHeaders to specify custom headers when sending requests to the Web server (or the parameter in HTTPGetEx).
cHTTPProxyByPassThis property allows you to specify a list of host names or IP Addresses that should not be routed through the proxy server. IOW, this list allows you to directly access the requested domains/IPs bypassing the proxy.
cHTTPProxyNameUse this method to override proxy information if the default Proxy connection types via nHTTPConnectType don't work for you.
cHttpProxyUserNameProxy server user name if the proxy requires a login.
clinkHTTP Link to visit on a site. Site relative URL. Example: /default.asp, /, /wconnect.dll?wwDemo~TestPage
cpasswordPassword to log on to server (applies to FTP and HTTP)
cResultCodeReturns the HTTP result code from a request. These are HTTP spec result codes that are typically returned in the HTTP response header from the Web Server.
cserverHTTP Server Address. Format: www.west-wind.com, or 111.111.111.111
cUserAgentThe name of the user agent that the wwIPStuff client sends to the Web server. Change this property if you need to emulate a specific browser like Internet Explorer or Netscape.
cusernameUsername for log in operations (FTP and HTTP).
lCacheRequestIf set causes the current request to be cached if possible so that subsequent requests do not go back to the server to retrieve the data.
lHttpCancelDownloadProperty that can be read to see whether the current request was cancelled with HTTPCancelDownload.
lIgnoreCertificateWarningsWhen .T. ignores warnings about invalid certificates. If the server responds with warnings rather than a complete revoked and out of date certificate, these warnings are ignored and the request continues as normal. The default behavior is that any warning causes an error.
nconnecttimeoutAllows setting the timeout period for an HTTP request. The timeout is specified in seconds and controls how long a Connect, Read or Send operation waits before being considered timed out.
nerrorThe last error code from an HTTP operation. Same as the value return by HttpGetEx typically.
nhttpconnecttypeAllows to specify how the connection is opened.
nhttppostmodeHTTP Post mode determines how requests are posted to the server. 1 - Form URLEncoded (default) 2 - Multipart forms. This property must be set prior to calling AddPostKey and HTTPGetEx
nHttpServiceFlagsFlags that are used on the HTTP connection in WinInet. These are passed to WinInet call of HttpOpenRequest(). For Internet Connection Handle options use nServiceFlags instead.
nhttpworkbuffersizeSize of the download HTTP buffer used while downloading dynamically sized requests with HTTPGetEx. This is the size of chunks that will be pulled at a time and also determines how often OnHTTPBufferUpdate is called.
nServiceFlagsUse this property to override internet service connection flags used by WinINet. Used in the call to InternetConnect().


See also:

Class wwHTTP

Last Updated: 10/9/2005 | Send topic feedback