Jump to content

HTTPRequest and ResponseText


Recommended Posts

Here is a link to a picture of my desktop which shows all the code and the output.

Posted Image

As you can see in wireshark the server is sending me back a packet which details the success of the login attempt however the AutoIt output is giving me pretty much nothing. This script use to work (sometimes) and sometimes this problem occurred.

Anyone know what's going on?

#include "md5.au3"

Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")

$username = "user"

$password = "pass"

$password_MD5 = md5($password)

Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "")

$oHTTP.Open($oMethod, $oURL, False)

$oHTTP.SetRequestHeader("User-Agent", "S2 Games/Heroes of Newerth/2.1.0.1/wac/i686")

$oHTTP.SetRequestHeader("Accept-Encoding", "gzip, deflate")

$oHTTP.SetRequestHeader("Connection", "Close")

$oHTTP.SetRequestHeader("Accept", "*/*")

If $oMethod = "POST" Then

$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

$oHTTP.Send($oData)

EndIf

ConsoleWrite("STATUS:" & @CRLF)

ConsoleWrite($oHTTP.status & @CRLF)

ConsoleWrite($oHTTP.statustext & @CRLF)

ConsoleWrite("HEADERS:" & @CRLF)

ConsoleWrite($oHTTP.GetAllResponseHeaders() & @CRLF)

ConsoleWrite("RESPONSE:" & @CRLF)

ConsoleWrite($oHTTP.ResponseText & @CRLF)

Return $oHTTP.ResponseText()

EndFunc

$url = "http://199.7.76.170/client_requester.php"

;url = "http://masterserver.hon.s2games.com/client_requester.php"

$data = "f=auth&login=" & $username & "&password=" & $password_MD5

$httpReturn = _HTTPRequest($oHTTP, "POST", $url, $data)

;ConsoleWrite($httpReturn)

;If StringInStr($httpReturn, "Invalid") Then

;ConsoleWrite("Fail" & @CRLF)

;EndIf

;If StringInStr($httpReturn, "super_id") Then

;ConsoleWrite("Success" & @CRLF)

;EndIf

If stringlen($httpReturn) > 100 Then

ConsoleWrite("Success" & @CRLF)

Else

ConsoleWrite("Fail" & @CRLF)

EndIf

Edited by xbayrockx
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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