; 初始化并获取会话句柄
$hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34")
; 获取连接句柄
$hConnect = _WinHttpConnect($hOpen, $sDomain)
; 设置请求
$hRequest = _WinHttpOpenRequest($hConnect, "POST", $sPage)
; 发送. 指定也要发送的其它数据. 这是 Google API 所必需的:
_WinHttpSendRequest($hRequest, "Content-Type: application/json; charset=utf-8" , $sAdditionalData)
; 等待响应
_WinHttpReceiveResponse($hRequest)
; 看看返回的是什么
Dim $sReturned
If _WinHttpQueryDataAvailable($hRequest) Then ; 如果有数据
Do
$sReturned &= _WinHttpReadData($hRequest)
Until @error
EndIf; 关闭句柄
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
; 看看返回的是什么
MsgBox(4096, "返回", BinaryToString($sReturned,4))
|