Author Topic: Accessing a website using cookies  (Read 1085 times)


  • Full Member
  • ***
  • Posts: 160
Accessing a website using cookies
« on: January 08, 2018, 03:41:48 pm »
I want to login to a site using cookies, but the script will not allow me to login.
Any ideas what I doing wrong?

Code: Winbatch

acc="Accept: test"
lan ="Accept-Language: en"
;encoding="Accept-Encoding: gzip, deflate"
user="User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)"
;length="Content-Length: 112"
conn="Connection: Keep-Alive"
cookie ="Cookie: test"
url = ""
lc_Login = "admin"
lc_pass = "pass"

;myheader=strcat(acc, @crlf, lan, @crlf, encoding, @crlf, user, @crlf, cookie, @crlf, host, @crlf, conn, @crlf, cookie)
myheader=strcat(acc, @crlf, lan, @crlf, user, @crlf, cookie, @crlf, host, @crlf, conn, @crlf, cookie)
;message("test", myheader)

TopHandle =ibegin(0,"","")
conhandle=iHostConnect(TopHandle, Url ,@HTTP, lc_Login, lc_pass)
datahandle=iHttpInit(conhandle, "GET", "/account/summary.action", "",0)
rslt=iHttpOpen(datahandle, Myheader, 0 , 0)
xx =ireaddata(datahandle,"c:\temp\temp.txt") ; writes whole html file


  • Tech Support
  • *****
  • Posts: 3349
    • WinBatch
Re: Accessing a website using cookies
« Reply #1 on: January 09, 2018, 07:06:17 am »
You should consider looking at the WinInet section of the Tech Database.  You can find it by searching for something like "iHostConnect".    Generally but not always, when logging on to a public website you need to post form data to log in.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade