Jump to content

Login to website with HTTP.UDF


Recommended Posts

Hello Autoit-friends!

Login to website with HTTP.UDF

I can't get the website content with _HTTPRead() after sending POST:

#include <HTTP.au3>
$host = "www.inselmacht.de"
$page = "/index.php"
$socket = _HTTPConnect($host)

$get = _HTTPGet($host, $page, $socket)
$recv = _HTTPRead($socket,1)

msgbox(0,"",$recv[4])

$result = StringInStr($recv[4], "PHPSESSID=")
msgbox(0,"position",$result)
$sid = StringMid($recv[4], $result+10, 32)

MsgBox(0, "", $sid)

$page = "/login.php?sid=" & $sid & " login_nick=user123&login_pw=123456&login_game=1&Submit=Zum+Spiel+..."
$num = _HTTPPost($host, $page)
MsgBox(0,"POST " & @error,$num)

$recv = _HTTPRead()
msgbox(0,@error,$recv)

Please check the script and tell me where the problem is. :)

Link to comment
Share on other sites

What did you use to capture the POST from the browser?

why should I capture the POST that I want to send to the server?

I thought that I POST to the server and get back the result with _HTTPread

the first part with _HTTPGet work without problems

Is there a difference in sending a POST-command?

Edited by fielmann
Link to comment
Share on other sites

34 views and no reply ? wacko...

Your method of logging-in to a gaming site - conspicuously using non-standard UDF's and determining a Session ID, might lead people to believe you are attempting to hack a website.

First, sign a confession that this is not what you are trying to do, then write an extensive treatise on morality generally, and lastly explain why you are trying to hack this website?

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

Your method of logging-in to a gaming site - conspicuously using non-standard UDF's and determining a Session ID, might lead people to believe you are attempting to hack a website.

First, sign a confession that this is not what you are trying to do, then write an extensive treatise on morality generally, and lastly explain why you are trying to hack this website?

I don't want to hack the site!

I want to build a robot that can build game-items automatictily.

Before I could do this, I have to enter with my account!

Link to comment
Share on other sites

There are many topics on the forums that cover logging-in to gaming sites and other sites. At the top of this webpage, toward the right, there is a "Search" link. Click on it and study some results, why not?

Das Häschen benutzt Radar

Link to comment
Share on other sites

There are many topics on the forums that cover logging-in to gaming sites and other sites. At the top of this webpage, toward the right, there is a "Search" link. Click on it and study some results, why not?

Why do you think I have started this case here?

I've already studied the forum before I started it.

Back to the roots: Do you have any technical information for the POST-problem ?

Link to comment
Share on other sites

This stuff is well beyond squirrely capability - but if you are wondering about where is the thread where the author of the include file "HTTP.au3", it is at this link.

I know the link!

Or where do you expect to find informations about HTTP.AU3 - UDF ???

I don't need a link, I need an answer for my POST-question why it does not work in palpable case!

Link to comment
Share on other sites

Well, I'm not using the same approach, but this is how I'm doing some screen scraping. It may be overkill (I'm too new to tell), but it works:

#include <IE.au3>; browser
#include <GUIConstants.au3>; GUI

Func WebGetPage($url)
  Local $text, $browser, $window, $GUIActiveX
  _IEErrorHandlerRegister()
  $browser = _IECreateEmbedded()
  GUISetState(@SW_HIDE);HIDE GUI
  $window = GUICreate($Config.item('Title_WebGetPage'))
  $GUIActiveX = GUICtrlCreateObj($browser, 1, 1)
  _IENavigate($browser, $url)
  $text = _IEBodyReadHTML($browser)
  $text = StringStripWS($text, 3)
  GUIDelete($window)
  return $text
EndFunc

edit: added 'includes'

Edited by aGorilla
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...