Martin Melka
Martin Melka

Reputation: 7799

Delphi - Connecting and logging in to a webpage

EDIT There has been quite a development. The current problem is this:

I compared requests sent from a browser and sent from my app. There have been some differences and I managed to correct most of them. Some are still unfixed, since I haven't figured it out how yet. I am using INDY.

Those are the two things in which my request differs from the browser's. Now, I am getting a 500 Internal Server Error at return, can it be caused by the lack of cookies or the second thing?

Thank you very much.

Upvotes: 0

Views: 1996

Answers (2)

Herman Sidharta
Herman Sidharta

Reputation: 139

Haven't exactly tried it myself but here's an example I found about website login using indy http://www.ciuly.com/delphi/indy/persistent-login-example-for-geocacheing-no-ssl/

Upvotes: 1

Rafael Colucci
Rafael Colucci

Reputation: 6078

Ok. Lets comment:

How can i send (or add) cookies into the request?

You should not do that. Indy handles this for you (but if really want to, there is a TidCookieManager). But it seems to me that you dont know how cookies work. Its not a thing you can add to a request. It cames from the server and it identifies you.

In the Headers I have this code: AcceptEncoding:='gzip,deflate,sdch';

AcceptEnconding tells to the server that it can compact the response using those algorithms. Indy supports gzip,deflate,sdch,identity and indy is updating que header request to add the one you forgot to put.

You should take a look at those links to learn how http works:

W3
Wikipedia

Upvotes: 0

Related Questions