Jump to content

Need Help on HTTP Get


Recommended Posts

Hi all,

just to clarify it before continuing reading: This is not a request for a hack but a request for statistics:

I'm playing a web game: Grepolis. Mainly you have to build several cities, fight players and so on.

For every city listed you have different buildings (accademy, barracks,...) with different levels.

What I'm looking for is to develop an unique tool have a complete panoramic of my situation (now I have to move from page to page or from city to city) so I can easily verify the level of all my cities.

Basically it's necessary to access the site (trough login and password) and HTTP get all info needed, then to copy and paste them into vars to use properly in my program.

I triple-checked in the forum but to be honest (try to understand me) I didn't find any suggestion that could help me to find a solution.

I ask to you, experts, if you can help me to find it.

Thanks so much for your attention,

Marco

Link to comment
Share on other sites

Ok, try this for login ! Posted Image

#include <IE.au3>

$url = "http://it.grepolis.com/"
$name= "name"
$password= "password"

$oIE= _IECreate ( $url )
_IELoadWait ( $oIE )
;  loginform  
Sleep ( 1000 )
$oForm = _IEFormGetObjByName ( $oIE, "loginform" )
$oUsername = _IEFormElementGetObjByname ( $oForm, "name" )
_IEFormElementSetValue ( $oUsername, $name )
$oPassword = _IEFormElementGetObjByname ( $oForm, "password" )
_IEFormElementSetValue ( $oPassword, $password )
; CheckBox autologin
$oForm = _IEFormGetObjByName ( $oIE, "loginform" )
 _IEFormElementCheckboxSelect ( $oForm, '', "autologin", 1, "byIndex" ) 
 ; login_button
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
    If StringInStr ( $oElement.tagname, 'SPAN' ) <> 0 And StringInStr ( $oElement.innerText, 'Accesso' ) <> 0 Then
        ConsoleWrite ( "Element Info Tagname: " & $oElement.tagname & "  innerText: " & $oElement.innerText & @Crlf )
        _IEAction ( $oElement, "click" )
        ExitLoop
    EndIf
Next
Exit
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

@wakilion

What you did is correct but not what I intended to do.

I mean, i don't need to login to the website or surfing it, I just need, once logged, to get the data from of my buildings and store them so I can create a tool to manage all my cities and decide what is better to do, I.E. checking stats of one city vs another one.

M.

Edited by marko001
Link to comment
Share on other sites

@wakilion

What you did is correct but not what I intended to do.

I mean, i don't need to login to the website or surfing it, I just need, once logged, to get the data from of my buildings and store them so I can create a tool to manage all my cities and decide what is better to do, I.E. checking stats of one city vs another one.

M.

Sorry for the misunderstood, but how can i access to the pages where you want catch infos ?

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Once you get logged you should get different infos.

First, the login sequence should be

http://" it.grepolis.com "/start?action=login

with name and password

Once logged you should get "Game.player_id" (string search Game.player_id) and "Game.townId" (string search "")that gives you the info for all your cities.

Then

http://"it.grepolis.com"/game/player?player_id=" + m_PlayerID

String l_TownID = "";
            String l_TownName = "";
            String l_Search = "Player.showTownInfoPopup(";

and so on to get details on the buildings.

M.

Link to comment
Share on other sites

Maybe this can be of help (done I think in Visual C):

{
                m_State = "login";
                loadSettingsRequest();

                setStatusBar("Connection to: " + m_Settings.UserName + "@" + m_Settings.Server);

                NameValueCollection l_Content = new NameValueCollection();
                String l_Url = "http://" + m_Settings.MainServer + "/start?action=login";
                Uri l_Uri = new Uri(l_Url);
                String l_ServerNr = "";
                l_ServerNr = m_Settings.Server.Substring(0, m_Settings.Server.IndexOf(".", 0));
                
                l_Content.Add("world", l_ServerNr);
                l_Content.Add("facebook_login", "");
                l_Content.Add("name", m_Settings.UserName);
                l_Content.Add("password", m_Settings.Password);

                m_HttpHandler.Headers.Add("user-agent", m_Settings.UserAgent);
                m_HttpHandler.UploadValuesAsync(l_Uri, l_Content);
            }
Edited by marko001
Link to comment
Share on other sites

Automating games: not allowed

Bumping topics within 24h of your last post: not allowed

Take a few minutes to read the forum etiquette (second link). I'd be surprised if this topic didn't get locked.

Edit: I'm not going to bump this up again but this is directed at the next post:

I understand the aim is to get information, but you are automating the game to get said information.

You're automating logging in for starters. Here is an example of a topic that got locked for just that.

Getting the information from your cities is a form of automation as well. (If you let AutoIt do it)

If you want your custom UI able to control elements of the game, that's automation, even if you have to manually trigger each action.

Lastly it doesn't even matter if the game has ToS against botting. Even minesweeper isn't safe.

However Grepolis ToS is very clear on the subject:

§7) Bots

The game may only be played with a conventional browser. Bots or other programs that automatically log on or trigger game actions are prohibited.

AutoIt is not a conventional browser.

Your script would qualify as "bot" or "other program that automatically logs on or triggers game actions" (leaving in the middle which one)

Even if Valik's announcement does have some technical loopholes, (like the definition of "game" and "automation") I think the message is very clear.

Looking at the faith of other topics claiming the announcement didn't apply to them only makes it clearer; If they didn't die through lack of interest they all end up locked. (or they where written before the rules changed)

/rant off

Edited by Tvern
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...