Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

[Delphi] auto login and get site

Posted on 2011-02-19
3
Medium Priority
?
1,635 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 34937278
php does not save the session in a cookie.

You aren't providing enough info to continue.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

721 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