Solved

[Delphi] auto login and get site

Posted on 2011-02-19
3
1,566 Views
Last Modified: 2012-05-11
Hi i have problem with login into one site with send post. I downloaded Fiddler and i have all post/gets. My code:
Input := TStringStream.Create('');
  Input2 := TStringStream.Create('');
  Output := TStringStream.Create('');
  Output2 := TStringStream.Create('');
  http.Request.UserAgent := 'User-Agent: Opera/9.80 (Windows NT 5.1; U; pl) Presto/2.2.15 Version/10.10';
  http.Request.ContentType := 'application/x-www-form-urlencoded';
  http.Port := 80;
  http.Host := '212.72.179.30';
  Input.WriteString('user=nick&password=pw&clear=true');
  Input2.WriteString('user=nick&password=passwordHASH');
  http.Connect;
  http.Post('http://www.plemiona.pl/index.php?action=login&server_list=1&show_server_selection=1?', Input, Output);
  http.Post('http://www.plemiona.pl/index.php?action=login&server_pl51?', Input2, Output2);

  Memo1.Text := Output.DataString;
  Memo2.Text := Output2.DataString;
  http.Get('http://pl51.plemiona.pl/login.php?sid=34677eb40219&secret=0&mobile_no_force=0',output);
  http.Get('http://pl51.plemiona.pl/cookie.php?url=game.php%3Fscreen%3Doverview%26intro&',output2);
  Memo3.Text := Output.DataString;
  Memo4.Text := Output2.DataString;
  http.Get('http://pl51.plemiona.pl/game.php?screen=overview&intro',output);
  Memo5.Text := Output.DataString;
  http.Disconnect;

Open in new window


I get error when i try to Get first site: "EIDHTTPProtocolException with message 'HTTP/1.1 302 Found'"
I think this is problem with permission with it:
 http.Get('http://pl51.plemiona.pl/login.php?sid=34677eb40219&secret=0&mobile_no_force=0',output);        "sid=34677eb40219" i dont know where i can get it firefox sending it automatically. I dont know session. Could someone help me?
0
Comment
Question by:l3m0n
  • 2
3 Comments
 
LVL 26

Expert Comment

by:EddieShipman
ID: 34935320
Make sure you have  the  HandleRedirects property set to true because it may be redirecting you and
the idHTTP is not following.
0
 

Author Comment

by:l3m0n
ID: 34936678
i changed HandleRedirects to true and now i dont get error. But first get returns "session is wrong". Where can i find session? i cant find in cookie using this: "javascript:alert(document.cookie)"
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 34937278
php does not save the session in a cookie.

You aren't providing enough info to continue.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction A frequent question goes something like this, "How can I show an introductory page to my clients on the first site visit, but not show it again on every visit?"  The answer is by using a cookie.  This article shows the design pattern f…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question