Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Dec : Indy's idHTTP POST method
| Subject: | Indy's idHTTP POST method |
| Posted by: | "Dale Francis" (dfranc..@mortgagesoftware.to) |
| Date: | Sat, 3 Dec 2005 18:13:17 |
The procedure below attempts to POST data to a site and receive a response.
It attempts to use the idHTTP component's POST method. The error returned
is an EIdHTTPProtocolException with the message:
"HTTP/1.1 403 Forbidden"
There is also a test site where you can supply your parameters and attempt
the POST independent of all things Borland Delphi. When using the Netscape
browser, I get the same results as I do with various procedures I've tried
with Delphi. But if I use Internet Explorer at the test site, I get back a
successful response.
What's that about? Anyway, here is the code...
procedure TForm1.Button1Click(Sender: TObject);
var
sURL : String;
sResponse : String;
slPostData : TStrings;
begin
sURL := 'http://ThisIsTheSite';
slPostData := TStringList.Create;
try
slPostData.LoadFromFile('C:\MyFile.req');
{here is the POST method that gives the FORBIDDEN error}
sResponse := IdHTTP1.Post(sURL, slPostData);
ShowMessage(sResponse);
finally
slPostData.Free;
end;
end;
Can you advise? Thank you,
Dale Francis