Board index » delphi » IdHttp Post error "302 Object Moved"?

IdHttp Post error "302 Object Moved"?

Hi,

I am trying to login through this URL
"http://isend.cellcom.co.il/english/Login.asp" where the "submit" form URL
in the "Login.asp" is "http://isend.cellcom.co.il/english/LoginCheck.asp".

procedure TForm1.Button3Click(Sender: TObject);

Var

  aStream: TMemoryStream;

  Params: TStringStream;

begin

  aStream := TMemoryStream.create;

  Params := TStringStream.create('');

  IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';

  try

    Params.WriteString(URLEncode('mfn=' + 'asa...@hotmail.com' + '&'));

    Params.WriteString(URLEncode('iccid=' + '12345'));

    with IdHTTP1 do begin

      try

        IdHTTP1.Post('http://isend.cellcom.co.il/english/LoginCheck.asp',
Params, aStream);

      except

        on E: Exception do

        showmessage('Error encountered during POST: ' + E.Message);

      end;

    end;

  aStream.WriteBuffer(#0' ', 1);

  RichEdit1.Text := PChar(aStream.Memory);

  except

  end;

end;

After pressing the button I am getting an Error number 302 end richedit
display the text:

"<head><title>Object moved</title></head>

<body><h1>Object Moved</h1>This object may be found <a
HREF="TextInput.asp">here</a>.</body>

"

How can I overcome this problem?

Thanks in advanced,

Asaf

 

Re:IdHttp Post error "302 Object Moved"?


maybe it helps if you set HandleRedirects to True

--

Bas Gooijen

Quote
"Asaf Goldman" <asa...@hotmail.com> wrote in message

news:3c934599_2@dnews...
Quote
> Hi,

> I am trying to login through this URL
> "http://isend.cellcom.co.il/english/Login.asp" where the "submit" form URL
> in the "Login.asp" is "http://isend.cellcom.co.il/english/LoginCheck.asp".

> procedure TForm1.Button3Click(Sender: TObject);

> Var

>   aStream: TMemoryStream;

>   Params: TStringStream;

> begin

>   aStream := TMemoryStream.create;

>   Params := TStringStream.create('');

>   IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';

>   try

>     Params.WriteString(URLEncode('mfn=' + 'asa...@hotmail.com' + '&'));

>     Params.WriteString(URLEncode('iccid=' + '12345'));

>     with IdHTTP1 do begin

>       try

>         IdHTTP1.Post('http://isend.cellcom.co.il/english/LoginCheck.asp',
> Params, aStream);

>       except

>         on E: Exception do

>         showmessage('Error encountered during POST: ' + E.Message);

>       end;

>     end;

>   aStream.WriteBuffer(#0' ', 1);

>   RichEdit1.Text := PChar(aStream.Memory);

>   except

>   end;

> end;

> After pressing the button I am getting an Error number 302 end richedit
> display the text:

> "<head><title>Object moved</title></head>

> <body><h1>Object Moved</h1>This object may be found <a
> HREF="TextInput.asp">here</a>.</body>

> "

> How can I overcome this problem?

> Thanks in advanced,

> Asaf

Re:IdHttp Post error "302 Object Moved"?


Thanks for your reply but now I am getting an error number 404 "Object not
found".
Is it somthing with Cookies?

Asaf

Quote
"Bas Gooijen" <bas_gooi...@yahoo.com> wrote in message

news:3c93495c$1_2@dnews...
Quote
> maybe it helps if you set HandleRedirects to True

> --

> Bas Gooijen

> "Asaf Goldman" <asa...@hotmail.com> wrote in message
> news:3c934599_2@dnews...
> > Hi,

> > I am trying to login through this URL
> > "http://isend.cellcom.co.il/english/Login.asp" where the "submit" form
URL
> > in the "Login.asp" is

"http://isend.cellcom.co.il/english/LoginCheck.asp".

- Show quoted text -

Quote

> > procedure TForm1.Button3Click(Sender: TObject);

> > Var

> >   aStream: TMemoryStream;

> >   Params: TStringStream;

> > begin

> >   aStream := TMemoryStream.create;

> >   Params := TStringStream.create('');

> >   IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';

> >   try

> >     Params.WriteString(URLEncode('mfn=' + 'asa...@hotmail.com' + '&'));

> >     Params.WriteString(URLEncode('iccid=' + '12345'));

> >     with IdHTTP1 do begin

> >       try

IdHTTP1.Post('http://isend.cellcom.co.il/english/LoginCheck.asp',

- Show quoted text -

Quote
> > Params, aStream);

> >       except

> >         on E: Exception do

> >         showmessage('Error encountered during POST: ' + E.Message);

> >       end;

> >     end;

> >   aStream.WriteBuffer(#0' ', 1);

> >   RichEdit1.Text := PChar(aStream.Memory);

> >   except

> >   end;

> > end;

> > After pressing the button I am getting an Error number 302 end richedit
> > display the text:

> > "<head><title>Object moved</title></head>

> > <body><h1>Object Moved</h1>This object may be found <a
> > HREF="TextInput.asp">here</a>.</body>

> > "

> > How can I overcome this problem?

> > Thanks in advanced,

> > Asaf

Re:IdHttp Post error "302 Object Moved"?


yes, i think so.

--

Bas Gooijen

Quote
"Asaf Goldman" <asa...@hotmail.com> wrote in message

news:3c934d6e_1@dnews...
Quote
> Thanks for your reply but now I am getting an error number 404 "Object not
> found".
> Is it somthing with Cookies?

> Asaf

> "Bas Gooijen" <bas_gooi...@yahoo.com> wrote in message
> news:3c93495c$1_2@dnews...
> > maybe it helps if you set HandleRedirects to True

> > --

> > Bas Gooijen

> > "Asaf Goldman" <asa...@hotmail.com> wrote in message
> > news:3c934599_2@dnews...
> > > Hi,

> > > I am trying to login through this URL
> > > "http://isend.cellcom.co.il/english/Login.asp" where the "submit" form
> URL
> > > in the "Login.asp" is
> "http://isend.cellcom.co.il/english/LoginCheck.asp".

> > > procedure TForm1.Button3Click(Sender: TObject);

> > > Var

> > >   aStream: TMemoryStream;

> > >   Params: TStringStream;

> > > begin

> > >   aStream := TMemoryStream.create;

> > >   Params := TStringStream.create('');

> > >   IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';

> > >   try

> > >     Params.WriteString(URLEncode('mfn=' + 'asa...@hotmail.com' +
'&'));

> > >     Params.WriteString(URLEncode('iccid=' + '12345'));

> > >     with IdHTTP1 do begin

> > >       try

> IdHTTP1.Post('http://isend.cellcom.co.il/english/LoginCheck.asp',
> > > Params, aStream);

> > >       except

> > >         on E: Exception do

> > >         showmessage('Error encountered during POST: ' + E.Message);

> > >       end;

> > >     end;

> > >   aStream.WriteBuffer(#0' ', 1);

> > >   RichEdit1.Text := PChar(aStream.Memory);

> > >   except

> > >   end;

> > > end;

> > > After pressing the button I am getting an Error number 302 end
richedit
> > > display the text:

> > > "<head><title>Object moved</title></head>

> > > <body><h1>Object Moved</h1>This object may be found <a
> > > HREF="TextInput.asp">here</a>.</body>

> > > "

> > > How can I overcome this problem?

> > > Thanks in advanced,

> > > Asaf

Re:IdHttp Post error "302 Object Moved"?


So How can I overcome this problem?

Asaf

Quote
"Bas Gooijen" <bas_gooi...@yahoo.com> wrote in message

news:3c936e54_1@dnews...
Quote
> yes, i think so.

> --

> Bas Gooijen

> "Asaf Goldman" <asa...@hotmail.com> wrote in message
> news:3c934d6e_1@dnews...
> > Thanks for your reply but now I am getting an error number 404 "Object
not
> > found".
> > Is it somthing with Cookies?

> > Asaf

> > "Bas Gooijen" <bas_gooi...@yahoo.com> wrote in message
> > news:3c93495c$1_2@dnews...
> > > maybe it helps if you set HandleRedirects to True

> > > --

> > > Bas Gooijen

> > > "Asaf Goldman" <asa...@hotmail.com> wrote in message
> > > news:3c934599_2@dnews...
> > > > Hi,

> > > > I am trying to login through this URL
> > > > "http://isend.cellcom.co.il/english/Login.asp" where the "submit"
form
> > URL
> > > > in the "Login.asp" is
> > "http://isend.cellcom.co.il/english/LoginCheck.asp".

> > > > procedure TForm1.Button3Click(Sender: TObject);

> > > > Var

> > > >   aStream: TMemoryStream;

> > > >   Params: TStringStream;

> > > > begin

> > > >   aStream := TMemoryStream.create;

> > > >   Params := TStringStream.create('');

> > > >   IdHTTP1.Request.ContentType :=

'application/x-www-form-urlencoded';

- Show quoted text -

Quote

> > > >   try

> > > >     Params.WriteString(URLEncode('mfn=' + 'asa...@hotmail.com' +
> '&'));

> > > >     Params.WriteString(URLEncode('iccid=' + '12345'));

> > > >     with IdHTTP1 do begin

> > > >       try

> > IdHTTP1.Post('http://isend.cellcom.co.il/english/LoginCheck.asp',
> > > > Params, aStream);

> > > >       except

> > > >         on E: Exception do

> > > >         showmessage('Error encountered during POST: ' + E.Message);

> > > >       end;

> > > >     end;

> > > >   aStream.WriteBuffer(#0' ', 1);

> > > >   RichEdit1.Text := PChar(aStream.Memory);

> > > >   except

> > > >   end;

> > > > end;

> > > > After pressing the button I am getting an Error number 302 end
> richedit
> > > > display the text:

> > > > "<head><title>Object moved</title></head>

> > > > <body><h1>Object Moved</h1>This object may be found <a
> > > > HREF="TextInput.asp">here</a>.</body>

> > > > "

> > > > How can I overcome this problem?

> > > > Thanks in advanced,

> > > > Asaf

Other Threads