 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
JoeAley2003 Guest
|
Posted: Sat Dec 27, 2003 5:08 am Post subject: Running Idhttp->Post |
|
|
Hi all.
I found this sample on the web and it doesn't compile on kylix
because URLEncode() was not found, so taking a look at help, i found
this function on TIdURI type. Now it compiles but don't run because of
a 'protocol field is empty' excpetion generated on the first line of
try... Params.WriteString(...
I don't know because as you can see, i have setted up the field in
the code and at the component.
////----------
Var
aStream: TMemoryStream;
Params: TStringStream;
begin
aStream := TMemoryStream.create;
Params := TStringStream.create('');
HTTP.Request.ContentType := 'application/x-www-form-urlencoded';
HTTP.ProtocolVersion := pv1_1;
try
Params.WriteString(TIdURI.URLEncode('login=' + 'teste (AT) teste (DOT) com' +
'&'));
Params.WriteString(TIdURI.URLEncode('password=""');
with HTTP do begin
try
HTTP.Post('http://www.mysite.com/cgi-bin/" name="login',
Params,aStream);
except
on E: Exception do
showmessage('Error encountered during POST: ' + E.Message);
end;
end;
aStream.WriteBuffer(#0' ', 1);
showmessage(PChar(aStream.Memory));
except
end;
end;
///////------------------------
Does someone has a working code different from this???
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|