Jump to content

Recommended Posts

Posted

Hi everyone.

I will be grateful to all who will help.

i want to login to site with WinHttpRequest.i will use the cookies which i've got from ie.

it doesn't work i don't know why.

PLEASE HELP !

 

#include <IE.au3>

Call(LoginSeo)

Func LoginSeo()


   $oIE = _IECreate('http://seosprint.net/')

   Sleep(30000)

   _IENavigate($oIE,"http://www.seosprint.net/index.php")


   $oDoc = _IEDocGetObj($oIE)
   $iCookies = $oDoc.cookie
   $sUserAgent = $oIe.document.parentWindow.navigator.userAgent
   _IELoadWait($oIE)
   Sleep(2500)
   ConsoleWrite($iCookies & @CRLF)
   _IEQuit($oIE)

   Global $oHTTP = ObjCreate('WinHttp.WinHttpRequest.5.1')

   ;******************************************************
   $oHTTP.Open("GET", 'http://www.seosprint.net/index.php', true)
   $oHTTP.SetRequestHeader("User-Agent", $sUserAgent)
   $oHTTP.SetRequestHeader("Host", "www.seosprint.net")
   $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
   $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.8,ru;q=0.5,az-Latn;q=0.3")
   $oHTTP.SetRequestHeader("Accept-Encoding", "gzip, deflate, sdch")
   $oHTTP.SetRequestHeader('Upgrade-Insecure-Requests', '1')
   $oHTTP.SetRequestHeader("Connection", "Keep-Alive")
   $oHTTP.SetRequestHeader("Referer", "http://www.seosprint.net/")
   $oHTTP.SetRequestHeader("Cookie", $iCookies)
   $oHTTP.Send()
   $oHTTP.WaitForResponse()
   ;******************************************************
   If $oHTTP.Status = 200 Then
      $sHTML = $oHTTP.ResponseText()
      ConsoleWrite($sHTML)
      Exit
   EndIf

EndFunc

 

  • 3 weeks later...
Posted (edited)

Maybe because this is security related problem ?
I mean What if each new server connection/sesion should have their own cookie ?

 

EDIT: btw.
You do not need to use CALL, just use function name like in this following example

; Call(LoginSeo)
LoginSeo()

Func LoginSeo()
...
EndFunc

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Ah .... this is quite resonable , as can not be two active sesion at the same time.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

btw.

@crauf1986 please read about COM ERROR Handler - use:
 

ObjEvent()

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

ok thantks.so i've not solved the problem.I used the calling function like that example and moved the  _IEQuit to the end of scrypt but it didn't solve the problem.

  On 6/30/2016 at 7:56 AM, mLipok said:

btw.

@crauf1986 please read about COM ERROR Handler - use:
 

ObjEvent ( )

 

Expand  

i didn't understand why i should use this code.why i need the COM ERROR Handler.How you i get a cookies from browser and want to use it in winhttp.

please you can register on site www.seosprint.net and test it.

PLEASE I NEED YOUR HELP.

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
  • Recently Browsing   0 members

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