CSimpleHTTPClient![]()
[ SimpleWebClient | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
![]()
Back to the top of CSimpleHTTPClient
This component implement a very basic HTTP client:
Provides one single method: Download (send an HTTP GET request and retrieve the document)
| Provides a timeout feature
| Handles WIN32 errors and provides COM error reporting (ISupportErrorInfo/IErrorInfo)
| Supports text data (uses BSTR) and binary data (uses SAFEARRAY of BYTEs)
| |
This component was designed for performance; it retrieves the document in memory, it's very small (32Ko) and uses the WIN32 WinInet API (low-level API for HTTP).
Back to the top of CSimpleHTTPClient
To use this COMponent:
Create an instance of this class
| Optionally, set the timeout property (in milliseconds)
| Call method DownloadPage
| Delete instance of the class
| |
Back to the top of CSimpleHTTPClient
<% Dim oHTTPSet oHTTP = Server.CreateObject("Emmanuel.SimpleHTTPClient.1")
Dim page_url page_url = Request.Form("PAGE_URL") Dim page_content Dim page_type
On Error Resume Next oHTTP.DownloadPage page_url, page_content, page_type
If Err <> 0 Then %> <HTML> <HEAD> <TITLE>Error When Downloading Page <%=page_url%></TITLE> </HEAD> <BODY>
<P><H2>Error When Downloading Page <%=page_url%></H2></P>
<P><B><%=Err.Description%></B></P>
</BODY> </HTML> <% Else ' No error: send back the page Response.Clear Response.ContentType = page_type Response.BinaryWrite page_content End If
%> </PRE>
Back to the top of CSimpleHTTPClient
ADMINISTRATIVE
Author Emmanuel KARTMANN - Emmanuel KARTMANN
Date Friday 2/4/00 2:48:59 PM
Back to the top of CSimpleHTTPClient
SEE ALSO
WinInet
Back to the top of CSimpleHTTPClient
Purpose: create an instance of the class
Parameters: none (C++ constructor)
Return value : none (C++ constructor)
Description :
CSimpleHTTPClient() ;Function is currently defined inline.
Back to the top of CSimpleHTTPClient
Purpose: download a document via HTTP
Parameters:
- in BPageURL
- Uniform Resource Locator of the document (its location)
- out pvPageContent
- content of the document. This variant's sub-type is the one requested (lRequestedType).
- out pvPageType
- type of document (the HTTP Content-Type, e.g. "text/html", "image/gif", etc...)
- in lRequestedType
- type of variable to create/store in pvPageContent. Can be any of the following values:
0 (icString): the document is returned in a variable of type Variant/String (this is the default) 1 (icVariant): the document is returned in a variable of type Variant/SafeArray of BYTEs Return value : HRESULT = S_OK for success, otherwise an error occurred.
Description : CAUTION: if the document type is incompatible with the requested type, the page content may contain corrupted values (i.e. if you download an an image and try to store it into a string, you won't get anything useful).
STDMETHOD(DownloadPage)(/*[in]*/ BSTR BPageURL, /*[out]*/ VARIANT *pvPageContent, /*[out]*/ VARIANT *pvPageType, /*[in, optional, default(0)]*/long lRequestedType);Back to the top of CSimpleHTTPClient
STDMETHOD(get_Timeout)( long *pVal);
Purpose: return the timeout value (in milliseconds)
Parameters:
Return value : HRESULT = S_OK for success, otherwise an error occurred.
- out pVal
- current timeout value
Description : -
STDMETHOD(get_Timeout)(/*[out, retval]*/ long *pVal);Back to the top of CSimpleHTTPClient
STDMETHOD(put_Timeout)( long newVal);
Purpose: set the timeout value (in milliseconds)
Parameters:
Return value : HRESULT = S_OK for success, otherwise an error occurred.
- in newVal
- new timeout value
Description : -
STDMETHOD(put_Timeout)(/*[in]*/ long newVal);Back to the top of CSimpleHTTPClient
All Members
- public:
- STDMETHOD(DownloadPage)( BSTR BPageURL, VARIANT *pvPageContent, VARIANT *pvPageType, long lRequestedType);
- STDMETHOD(get_Timeout)( long *pVal);
- STDMETHOD(put_Timeout)( long newVal);
- protected:
Back to the top of CSimpleHTTPClient
Ancestors
Inheritance chain for CSimpleHTTPClient:
CComCoClass CComObjectRootEx IDispatchImpl ISupportErrorInfo Back to the top of CSimpleHTTPClient
Descendants
Class is not inherited by any others.
Back to the top of CSimpleHTTPClient
Generated from source by the Cocoon utilities on Mon Feb 14 10:04:23 2000 .
Report problems to jkotula@stratasys.com