Solved

[Delphi] auto login and get site

Posted on 2011-02-19
3
1,556 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now