http Read method
Return to Introduction  Previous page  Next page
Applies to
auHTTP component.  

Declaration
function Read(ForceWaitThread: Boolean = False): Boolean; // returns False if busy OR WaitTimeout expired  

Description
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.  

Example (code demonstrates how to search for 'HTTP' keyword in Torry.net)
Delphi:  
procedure TForm1.ReadBtnClick(Sender: TObject);  
begin  
  auHTTP1.URL := 'http://www.torry.net/quicksearch.php';  
  auHTTP1.POSTData := 'String=HTTP&Exact=Yes&Title=No';  
  auHTTP1.Read;  
end;  



C++ Builder:  
void __fastcall TForm1::ReadBtnClick(TObject *Sender)  
{  
  auHTTP1->URL = "http://www.torry.net/quicksearch.php";  
  auHTTP1->POSTData = "String=HTTP&Exact=Yes&Title=No";  
  auHTTP1->Read();  
}  

Remarks
iiwarning 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.  

See also
URL, RequestMethod, POSTData and Busy properties;  
WaitThread and WaitTimeout properties;  
Upload, Abort, Pause and Resume methods;  
HTTPReadString function.  
File not found.