

| Type | Description | |||
| URL as String | A string expression that indicates the HTTP URL to retrieve. The URL parameter may start with http:// or without. You can specify the web server's port by calling something like: http://www.yourserver.com:8080/index.htm, where, the 8080 is the port to be used. By default, the control uses the port 80. | |||
| Variant | A string expression or a safe array of bytes that indicates the body of the message, if the GET operation was ok |
The following VB sample displays the https://www.exontrol.com web page, in HTML format ( before running the following code, you need to add the exHTTP library to the project's references ):
Dim h As New EXHTTPLib.HTTP
Debug.Print h.GET("https://www.exontrol.com")
The following VB sample gets the https://exontrol.com/images/cart.gif picture/document to a safe array:
Dim h As New EXHTTPLib.HTTP
Dim v As Variant, i
v = h.GET("https://exontrol.com/images/cart.gif")
For Each i In v
Debug.Print Hex(i)
Next
The following VB.NET sample displays the https://www.exontrol.com web page ( before running the following code, you need to add the exHTTP library to the project's references ):
Dim n As New EXHTTPLib.HTTP
Debug.WriteLine(n.GET("https://www.exontrol.com").ToString())The following C++ sample displays the https://www.exontrol.com web page:
#include <atlbase.h>
#import "c:\winnt\system32\ExHTTP.dll"
static COleVariant GET( LPCTSTR szURL, HRESULT* phtError = NULL )
{
COleVariant vtRequest;
IUnknown* punkHTTP = NULL;
OleInitialize( NULL );
if ( SUCCEEDED( CoCreateInstance( __uuidof( EXHTTPLib::HTTP ), NULL, CLSCTX_ALL, IID_IUnknown, (LPVOID*)&punkHTTP ) ) )
{
if ( EXHTTPLib::IHTTPPtr spHTTP( punkHTTP ) )
{
USES_CONVERSION;
HRESULT htError = spHTTP->get_GET( T2OLE(szURL), &vtRequest );
if ( phtError )
*phtError = htError;
}
punkHTTP->Release();
}
OleUninitialize();
return vtRequest;
}
static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
if ( pv )
{
if ( pv->vt == VT_ERROR )
return szDefault;
COleVariant vt;
vt.ChangeType( VT_BSTR, pv );
return V_BSTR( &vt );
}
return szDefault;
}