Das dürfte eine HTTPS-Verbindung sein, ohne Windows-API-Aufrufe dürfte das schwer sein.
Der Minecraft-Auth-Prozess brauchte auch sowas, dabei ist das hier rausgekommen:
Code: Alles auswählen
Procedure.s Mojang_server(do$,json$)
#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
;
; Do NOT include http:// or any other protocol indicator here
;
host.s = "authserver.mojang.com"
;
; Everything after the hostname of the server
;
get_url.s = "/"+do$;authenticate"
;
; 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_("MinecraftStarter",#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,"POST",get_url,"","",0,#INTERNET_FLAG_SECURE,0)
headers.s = "Content-Type: application/json" +Chr(13)+Chr(10)
HttpAddRequestHeaders_(request_handle,headers,Len(headers), #HTTP_ADDREQ_FLAG_REPLACE | #HTTP_ADDREQ_FLAG_ADD)
post_data.s =json$;
post_data_len = Len(post_data)
send_handle = HttpSendRequest_(request_handle,"",0,post_data,post_data_len)
buffer = AllocateMemory(2024)
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 + PeekS(buffer,bytes_read,#PB_Ascii)
Until bytes_read=0
FreeMemory(buffer)
ProcedureReturn result
EndProcedure
Procedure.s Mojang_Auth(name$,password$,clientid$)
json$="{ "+Chr(34)+"agent"+Chr(34)+": { "+Chr(34)+"name"+Chr(34)+": "+Chr(34)+"Minecraft"+Chr(34)+", "+Chr(34)+"version"+Chr(34)+": 1 }, "
json$+Chr(34)+"username"+Chr(34)+": "+Chr(34)+name$+Chr(34)+", "
json$+Chr(34)+"password"+Chr(34)+": "+Chr(34)+password$+Chr(34)
If clientid$<>""
json$+", "+Chr(34)+"clientToken"+Chr(34)+": "+Chr(34)+clientid$+Chr(34)
EndIf
json$+" }"
;Debug "send:"+json$
result$=clear_json(Mojang_server("authenticate",json$))
;Debug "auth:"+result$
ProcedureReturn result$
EndProcedure
Procedure.s Mojang_Refresh(token$,clientid$)
json$="{ "
json$+Chr(34)+"accessToken"+Chr(34)+": "+Chr(34)+token$+Chr(34)+", "
json$+Chr(34)+"clientToken"+Chr(34)+": "+Chr(34)+clientid$+Chr(34)
json$+" }"
;Debug "send:"+json$
result$=clear_json(Mojang_server("refresh",json$))
;Debug "refresh:"+result$
ProcedureReturn result$
EndProcedure
vielleicht hilfreich für den Anfang.
Dort muss man per Post ein json rüberschicken und bekommt dann eintsprechend antwort. In Header muss da auch ein "Content-Type: application/json" vorhanden sein.
Edit: Das ursprüngliche Teil müsste aus den CodeArchiv kommen:
[
http://purearea.net/pb/CodeArchiv/CodeArchiv.html] Die Seite ist nicht hübsch, aber man findet doch einiges.