Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1652
  • Last Modified:

[Delphi] auto login and get site

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
l3m0n
Asked:
l3m0n
  • 2
1 Solution
 
EddieShipmanCommented:
Make sure you have  the  HandleRedirects property set to true because it may be redirecting you and
the idHTTP is not following.
0
 
l3m0nAuthor Commented:
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
 
EddieShipmanCommented:
php does not save the session in a cookie.

You aren't providing enough info to continue.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now