http RequestMethod property
Return to Introduction  Previous page  Next page
Applies to
auHTTP component.  

Declaration
type  
  TauHTTPRequestMethod = (rmAutoDetect, rmGET, rmPOST);  
 
property RequestMethod: TauHTTPRequestMethod;  

Description
The RequestMethod (HTTP method) property is instruction sent in a request message that notifies an HTTP server of the action to perform on the specified resource.  
 
For example, rmGET specifies that a resource is being retrieved from the server. rmPOST specifies that client should upload (post) some specific information which should processed by server before downloading the data.  
 
When RequestMethod is rmAutoDetect, the HTTP component will autimatically detect how to request data from server. When POSTData string is empty, component will use GET method. If POSTData specified, POST method will be used.  
 


tip When you reading data from CGI script using GET method, you should specify reqired information behind question mark, i.e.: http://www.website.com/cgi-bin/script.cgi?datafield1=datavalue2&datafield2=datavalue2  
 
If CGI program accepts data via POST method, you should specify required data in the POSTData property together with the URL string.  
 


Example 1: (requesting data from the CGI script (at DelphiPages.com) via GET method)
procedure TForm1.ReadBtnClick(Sender: TObject);  
begin  
  auHTTP1.URL := 'http://www.delphipages.com/result.cfm?SR=HTTP&AO=and&RequestTimeout=500';  
  auHTTP1.Read;  
end;  
 
procedure TForm1.auHTTP1Done(Sender: TObject; ContentType: string; FileSize: Integer; Stream: TStream);  
begin  
  // Receiving content from Stream  
end;  
 
{ Click link below to see demo:  
http://www.delphipages.com/result.cfm?SR=HTTP&AO=and&RequestTimeout=500 }  

Example 2: (requesting data from the CGI script (at Torry.net) via POST method)
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;  
 
procedure TForm1.auHTTP1Done(Sender: TObject; ContentType: string; FileSize: Integer; Stream: TStream);  
begin  
  // Receiving content from Stream  
end;  

See also
URL property.  
File not found.