Read method
|
WinHTTP component.
|
function Read(ForceWaitThread: Boolean = False): Boolean; // returns False if busy OR WaitTimeout expired
|
The Read method initiate the HTTP request to download the data from location specified in the URL property. Function returns False if component currently busy (already processing request), OR WaitTimeout is expired (if you waiting for completion of request in the function that calls this medod, using WaitThread property).
|
|
The ForceWaitThread is optional (not necessary to specify) parameter, which can temporary set WaitThread to True for only current call of Read method.
|
Delphi:
|
procedure TForm1.ReadBtnClick(Sender: TObject);
|
begin
|
WinHTTP1.URL := 'http://www.torry.net/quicksearch.php';
|
WinHTTP1.POSTData := 'String=HTTP&Exact=Yes&Title=No';
|
WinHTTP1.Read;
|
end;
|
C++ Builder:
|
void __fastcall TForm1::ReadBtnClick(TObject *Sender)
|
{
|
WinHTTP1->URL = "http://www.torry.net/quicksearch.php";
|
WinHTTP1->POSTData = "String=HTTP&Exact=Yes&Title=No";
|
WinHTTP1->Read();
|
}
|
The Read method fails and OnHostUnreachable event occurs if you're trying to POST some data to the CGI but user currently working offline (even if connection to the Internet present). Posting to the CGI programs requires active Internet connection.
|
URL, RequestMethod, POSTData and Busy properties;
|
WaitThread and WaitTimeout properties;
|
Upload, Abort, Pause and Resume methods;
|
HTTPReadString function.
|