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

hdsouza

  • Full Member
  • ***
  • Posts: 139
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
AddExtender("WWINT44I.DLL")

acc="Accept: test"
lan ="Accept-Language: en"
;encoding="Accept-Encoding: gzip, deflate"
user="User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)"
host="Host: www.lendingclub.com"
;length="Content-Length: 112"
conn="Connection: Keep-Alive"
cookie ="Cookie: test"
HtmlFile="http://www.lendingclub.com"
url = "www.lendingclub.com"
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
 

td

  • Tech Support
  • *****
  • Posts: 2538
    • 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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates