Thanks for that headsup Pantcho! Anyways, it so happens that I don't want to POST, I want to send a GET request for a file named "pprdr.asp". There doesn't seem to be any explanation for HTTPS GET in the forum, so I'm wondering if anyone here knows how to do it?
Here's source from the forum that I've modified slightly to try to make it work (without luck):
Code: Select all
; English forum: http://purebasic.myforums.net/viewtopic.php?t=8302&highlight=
; Author: Karbon
; Date: 12. November 2003
; Note by Andre: I've changed #INTERNET_DEFAULT_HTTP_PORT = 443 to
; #INTERNET_DEFAULT_HTTPS_PORT = 443 (be aware of the additional 'S' at '_HTTPS_')
; because the #INTERNET_DEFAULT_HTTP_PORT constant is already declared in a .res
; file with another value
; This one does SSL, all you need to do for standard HTTP is change the
; INTERNET_FLAG_SECURE To 0 and the port to 80.
;
; All stuff for the WinInet lib.
;
#INTERNET_OPEN_TYPE_DIRECT = 1
#HTTP_ADDREQ_FLAG_ADD = $20000000
#HTTP_ADDREQ_FLAG_REPLACE = $80000000
#INTERNET_FLAG_SECURE = $800000
;
; Type of connection (could be FTP Gopher etc). HTTPS is done as HTTP too.
;
#INTERNET_SERVICE_HTTP = 3
;
; HTTP port is 80, HTTPS (SSL) port is 443.
;
#INTERNET_DEFAULT_HTTPS_PORT = 443
Procedure.s do_post()
;
; Do NOT include http:// or any other protocol indicator here
;
host.s = "nexus.passport.com"
;
; Everything after the hostname of the server
;
get_url.s = "/rdr/pprdr.asp"
;
; Holds the result from the CGI/page
;
result.s = ""
;
; All from the wininet DLL
;
; Be sure your Internet Explorer is up to date!
;
open_handle = InternetOpen_("BlitzMessenger",#INTERNET_OPEN_TYPE_DIRECT,"","",0)
connect_handle = InternetConnect_(open_handle,host,#INTERNET_DEFAULT_HTTPS_PORT,"","",#INTERNET_SERVICE_HTTP,0,0)
request_handle = HttpOpenRequest_(connect_handle,"GET",get_url,"HTTP/1.0","",0,#INTERNET_FLAG_SECURE,0)
headers.s = "Content-Type: application/x-www-form-urlencoded" +Chr(13)+Chr(10)
;HttpAddRequestHeaders_(request_handle,headers,Len(headers), #HTTP_ADDREQ_FLAG_REPLACE | #HTTP_ADDREQ_FLAG_ADD)
post_data.s = ""
post_data_len = Len(post_data)
;send_handle = HttpSendRequest_(request_handle,"",0,post_data,post_data_len)
buffer.s = Space(1024)
bytes_read.l
total_read.l
total_read = 0
;
; Read until we can't read anymore..
; The string "result" will hold what ever the server pushed at us.
;
Repeat
InternetReadFile_(request_handle,@buffer,1024,@bytes_read)
result + Left(buffer,bytes_read)
buffer = Space(1024)
Until bytes_read=0
ProcedureReturn(result)
EndProcedure
test.s = do_post.s()
CreateFile(0, "test.txt")
WriteString(test.s)
This doesn't work.. what I end up with is a blank text file. What I need to do is this:
Send a blank HTTPS GET request for the asp file with no headers or anything like that. It should look like this:
GET /rdr/pprdr.asp HTTP/1.0\r\n
\r\n
Edit:
If done right, the server's response should look something like this:
Code: Select all
<<< HTTP/1.1 200 OK\r\n
<<< Server: Microsoft-IIS/5.0\r\n
<<< Date: Mon, 02 Jun 2003 11:57:47 GMT\r\n
<<< Connection: close\r\n
<<< PassportURLs: DARealm=Passport.Net,DALogin=login.passport.com/login2.srf,DAReg=http://register.passport.net/uixpwiz.srf,Properties=https://register.passport.net/editprof.srf,Privacy=http://www.passport.com/consumer/privacypolicy.asp,GeneralRedir=http://nexusrdr.passport.com/redir.asp,Help=http://memberservices.passport.net/memberservice.srf,ConfigVersion=11\r\n
<<< Content-Length: 0\r\n
<<< Content-Type: text/html\r\n
<<< Cache-control: private\r\n
<<< \r\n