Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : Post idhttp object with multiform

www.cryer.info
Managed Newsgroup Archive

Post idhttp object with multiform

Subject:Post idhttp object with multiform
Posted by:"newsgroups.borland.com" (borland.public.delphi.internet.winso..@newsgroups.borland.com)
Date:Wed, 8 Mar 2006 10:32:02

When i try to post a form to an url (correct at the correct port) the
service response me that the form doesn't contain a specific field (I think
that it's the same for every fields in the form).
where I fault???
(I have tried with both 9 and 10 version of indy)

Thanks a lot
Axel


procedure TWebSenderNuovo.OttieniToken;
var
  FormData: TidMultiPartFormDataStream;
ResponseStream: TMemoryStream;
begin
  Formdata := TIdMultiPartFormDataStream.Create;
  ResponseStream := TMemoryStream.Create;
  // FHttp.Request.ContentType := 'application/x-www-form-urlencoded';
   try
    Formdata.AddFormField(K_FORM_TOKEN,'UPLOAD');
    Formdata.AddFormField(K_FORM_USER,FUser);
    Formdata.AddFormField(K_FORM_PASS,FPwd);
    FormData.Position := 0;

    FHttp.Port := K_SSLPort;
    FHttp.Request.ContentType := FormData.RequestContentType;

   FHttp.Post(K_URL_TOK+K_URL_AUTH,FormData,ResponseStream) ;


     ResponseStream.SaveToFile('c:\fresponse.asc');
  finally
  Formdata.Free;
    ResponseStream.Free;
   end;
    //se richiesto comprimo il file da inviare

end;


constructor TWebSenderNuovo.Create;
begin
  FHttp:= TIdHttp.Create(nil);
  FHttp.Request.Clear;
  FHttp.IOHandler := TIdSSLIOHandlerSocket.Create(FHttp);
  FHttp.ProxyParams.BasicAuthentication := true;
  FHttp.Request.BasicAuthentication := True;
  FResponse := TStringList.Create;

end;


destructor TWebSenderNuovo.Destroy;
begin
  FHttp.Free;
  FResponse.Free;
  inherited;
end;


//Richiesta autenticazione su server sicuro SSL
procedure TWebSenderNuovo.Inizializza(user,Password:string);

begin
  FUser := User;
  FPwd := Password;
  FHttp.Port := K_SSLPort;
  FHttp.Host:=K_URL_TOK;
  FHttp.Request.Username := FUser;
  FHttp.Request.Password := FPwd;

    FHttp.ProxyParams.BasicAuthentication := true;
  FHttp.Request.BasicAuthentication := true;

end;

Replies:

www.cryer.info
Managed Newsgroup Archive