http POSTData property
Return to Introduction  Previous page  Next page
Applies to
WinHTTP component.  

property POSTData: String;  

The POSTData property specifies any optional data to send with the HTTP request. The optional data can be the resource or information being posted to the server.  
tip The POSTData property is generally used to POST some data to the CGI programs. For example, you would like to emulate submission of some online form. Set the POSTData accordingly to the fields of HTML form. The format is following:  
(Separate entries with "&" character.) Then just point the URL property to the CGI script (specified as <form action=URL> tag in HTML format) and call Read method to submit the form.  

Example: (requesting data from the CGI script (at via POST method)
procedure TForm1.ReadBtnClick(Sender: TObject);  
  WinHTTP1.URL := '';  
  WinHTTP1.POSTData := 'String=HTTP&Exact=Yes&Title=No';  
procedure TForm1.WinHTTP1Done(Sender: TObject; ContentType: string; FileSize: Integer; Stream: TStream);  
  // Receiving content from Stream  

iiinfo Remarks
1.When you trying to POST data to the CGI program specifying the POSTData property, make sure that RequestMethod has set to rmAutoDetect or rmPOST;  
2.The WinHTTP component unable to post data to the CGI program when user working offline (even if user connected to the Internet). In this case, when you call the Read method, the OnHostUnreachable event occurs. Posting to the CGI programs requires active Internet connection.  

See also
RequestMethod property and Read method.