Hi!
How can I login to this site (and download the webpage) using WinAPI?
Link: https://lms.hfk.no/
The site is using some kind of IE login thing similar to a FTP login.
Need help with HTTPS authentication/login
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
That is a standard HTTP authentication, and the response headers tell me it's using the NTLM method.
A quick search on google for: http authentication ntlm
Came up with this: http://www.innovation.ch/personal/ronald/ntlm.html
Hopefully that should get you started at making the necessary handshake code for login. (you still need a valid user and pass from whomever run that site which I assume you have?)
And the fact it uses https:// do not really matter as you can try with http:// as well, but for proper support you might want to do https support too. (poke around these forums for info on https downloads etc.)
A quick search on google for: http authentication ntlm
Came up with this: http://www.innovation.ch/personal/ronald/ntlm.html
Hopefully that should get you started at making the necessary handshake code for login. (you still need a valid user and pass from whomever run that site which I assume you have?)
And the fact it uses https:// do not really matter as you can try with http:// as well, but for proper support you might want to do https support too. (poke around these forums for info on https downloads etc.)
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
Ærlig talt, hvorfor tror alle at jeg er en hacker/haxxor?Rescator wrote:That is a standard HTTP authentication, and the response headers tell me it's using the NTLM method.
A quick search on google for: http authentication ntlm
Came up with this: http://www.innovation.ch/personal/ronald/ntlm.html
Hopefully that should get you started at making the necessary handshake code for login. (you still need a valid user and pass from whomever run that site which I assume you have?)
And the fact it uses https:// do not really matter as you can try with http:// as well, but for proper support you might want to do https support too. (poke around these forums for info on https downloads etc.)

Selvfølgelig har jeg passord og brukernavn.
Translation to english: bla, bla, bla....
-
- PureBasic Expert
- Posts: 2812
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
I did this code to post to Blogger with https...
It just connects to it for now, but maybe it gives you some pointers!
It just connects to it for now, but maybe it gives you some pointers!
Code: Select all
; All stuff for the WinInet lib.
#INTERNET_OPEN_TYPE_DIRECT = 1
#INTERNET_OPEN_TYPE_PRECONFIG = 0
#HTTP_ADDREQ_FLAG_ADD = $20000000
#HTTP_ADDREQ_FLAG_REPLACE = $80000000
#INTERNET_FLAG_SECURE = $800000
#INTERNET_FLAG_RELOAD = $80000000
#INTERNET_FLAG_PRAGMA_NOCACHE = $100
#INTERNET_FLAG_KEEP_CONNECTION = $400000
#INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP = $8000
#INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS = $4000
#INTERNET_FLAG_IGNORE_CERT_CN_INVALID = $1000
#INTERNET_FLAG_IGNORE_CERT_DATE_INVALID = $2000
#INTERNET_FLAG_EXISTING_CONNECT = $20000000
; Type of connection (could be FTP Gopher etc). HTTPS is done as HTTP too.
#INTERNET_SERVICE_HTTP = 3
; custom
#INTERNET_HTTP_PORT=80
#INTERNET_HTTPS_PORT=443
;#INTERNET_FLAG_SECURE
; open_handle = InternetOpen_("User Agent Info Goes Here",#INTERNET_OPEN_TYPE_DIRECT,"","",0)
; url.l=InternetOpenUrl_(open_handle)
Procedure.s do_post (host.s, url.s, login.s , Password.s, port, secureflag)
result.s = ""
; All from the wininet DLL
open_handle = InternetOpen_("User Agent Info Goes Here",#INTERNET_OPEN_TYPE_DIRECT,"","",0)
connect_handle = InternetConnect_(open_handle,host,#INTERNET_HTTPS_PORT,login,Password,#INTERNET_SERVICE_HTTP,0,0)
request_handle = HttpOpenRequest_(connect_handle,0,url,"HTTP/1.1","",0,#INTERNET_FLAG_SECURE,0)
headers.s = "";"Content-Type: application/x-www-form-urlencoded"+Chr(13)+Chr(10)
post_data.s = login +":" + Password
auth_pass.s=Space(512)
Base64Encoder(@post_data,Len(post_data),@auth_pass,512)
headers.s+"Authorization: BASIC "+ Trim(auth_pass) +Chr(13)+Chr(10)
;HttpAddRequestHeaders_(request_handle,headers,Len(headers), #HTTP_ADDREQ_FLAG_REPLACE | #HTTP_ADDREQ_FLAG_ADD)
send_handle = HttpSendRequest_(request_handle,"",0,headers,Len(headers))
Buffer.s = Space(10240)
bytes_read.l = 0
total_read.l = 0
; Read until we can't read anymore..
ct=0
Repeat
z=InternetReadFile_(request_handle,@Buffer,10240,@bytes_read)
result + Left(Buffer,bytes_read)
Buffer = Space(10240)
ct+1
Until bytes_read=0
ProcedureReturn result
EndProcedure
Debug do_post("www.blogger.com","/atom/xxxxxx","username","password",#INTERNET_HTTPS_PORT,#INTERNET_FLAG_SECURE )
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact: