 |
CHTTPRequest - is small Windows library (12.0 Kb file size)
allows you to easy get/post information using HTTP protocol.
Key features
- Proxy support
- Proxy authorization support (Basic, Base64)
- Timeout for connect and receive
- GET/POST support
- User-defined callback function for cancel download
- User-defined callback function for display operation progress
- User-defined "User-Agent" header
- User-defined HTTP headers
- Multithreaded DLL
Download
Download CHTTPRequest Windows library: httpreq.zip (9.1 Kb)
Example of usage (C++ Builder)
//-------------------------------------------------------
#include "Structs.h"
//-------------------------------------------------------
BOOL __stdcall OnCancel(void* pForm)
{
TForm1* frm = (TForm1*) pForm;
if(!frm)
return true;
return frm->GetStopped();
}
//-------------------------------------------------------
bool __fastcall TForm1::GetStopped()
{
return CheckBox1->Checked;
}
//-------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
HANDLE hLib = LoadLibrary("httpreq.dll");
if(hLib)
{
CMakeRequest mr = (CMakeRequest)
GetProcAddress(hLib,"MakeRequest");
CFreeInstance free_instance = (CFreeInstance)
GetProcAddress(hLib,"FreeInstance");
if(mr && free_instance)
{
IN_PARAMS in;
OUT_PARAMS out;
char url[256] = {0};
strcpy(url,Edit1->Text.c_str());
in.URL = url;
in.OnCancel = OnCancel;
in.UserData = this;
in.Method = rmGet;
if(mr(in,out))
{
ShowMessage(out.Body);
}
else ShowMessage(out.ResultCode);
free_instance(out.Instance);
} // if(mr && free_instance)
FreeLibrary(hLib);
} // if(hLib)
}
//-------------------------------------------------------
Download
Download CHTTPRequest Windows library: httpreq.zip (9.1 Kb)
|