Main task is POST-autorization via Delphi program. Using the REST Client I found that, having url of site and two headers: *login_email* and *login_pass* I can successfully get the HTML codу and my POST auth form is OK, I'm logged in.
However, I wrote this Delphi code:
DataToSend := TStringList.Create;
DataToSend.Add('');
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Request.CustomHeaders.AddValue('login_email','some_email');
IdHTTP1.Request.CustomHeaders.AddValue('login_pass','some_password');
Memo1.Lines.Add(idHTTP1.Post('http://url.com', DataToSend));
My custom headers are not URL encoded.
I see the request headers:
Server: nginx/1.0.8
Date: Sun, 01 Sep 2013 17:03:59 GMT
Content-Type: text/html; charset=windows-1251
Connection: close
X-Powered-By: PHP/5.2.6-1+lenny16
Vary: Accept-Encoding
but ontained HTML is same page, for which POST-request has been sent with unprocessed form.
What am I doing wrong ?
User-Agent
set by Indy. If that's your case, you may try to fill theIdHTTP1.Request.UserAgent
property with one of the favorite browsers to fake the server that you are browser. But it's just my guess (and quite a frequent problem). – TLama