vb6.0/vba [vba] vba를 이용한 롯데택배 로그인 및 로그아웃
페이지 정보
본문
Option Explicit
Sub program1472_com()
Dim URL As String, Cookie As String, PostData As String
Dim T As String
Dim accessToken As String, principal As String, credential As String
principal = "아이디"
credential = "비밀번호"
PostData = "{""principal"":""" & principal & """,""credential"":""" & credential & """,""macAddress"":""normal-browser""}"
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "POST", URL
.SetRequestHeader "Accept", "application/json, text/javascript, */*; q=0.01"
.SetRequestHeader "Content-Type", "application/json"
.SetRequestHeader "X-Requested-With", "XMLHttpRequest"
.SetRequestHeader "Referer", "https://partner.alps.llogis.com/main/pages/sec/authentication"
.SetRequestHeader "Accept-Language", "ko-KR"
.SetRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
.SetRequestHeader "Host", "partner.alps.llogis.com"
.SetRequestHeader "Content-Length", Len(PostData)
.SetRequestHeader "Connection", "Keep-Alive"
.SetRequestHeader "Cache-Control", "no-cache"
If Len(Cookie) Then .SetRequestHeader "Cookie", Cookie
.Send PostData
.WaitForResponse: DoEvents
Debug.Print .getAllResponseHeaders
T = .ResponseText
End With
Debug.Print T
accessToken = Split(Split(T, """accessToken""")(1), """")(1)
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "POST", URL
.SetRequestHeader "Accept", "application/json, text/javascript, */*; q=0.01"
.SetRequestHeader "Content-Type", "application/json"
.SetRequestHeader "Authorization", accessToken
.SetRequestHeader "X-Requested-With", "XMLHttpRequest"
.SetRequestHeader "Referer", "https://partner.alps.llogis.com/main/pages/layout/main?token=" & accessToken
.SetRequestHeader "Accept-Language", "ko-KR"
' .SetRequestHeader "Accept-Encoding", "gzip, deflate"
.SetRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
.SetRequestHeader "Host", "partner.alps.llogis.com"
.SetRequestHeader "Content-Length", "2"
.SetRequestHeader "Connection", "Keep-Alive"
.SetRequestHeader "Cache-Control", "no-cache"
If Len(Cookie) Then .SetRequestHeader "Cookie", Cookie
.Send
.WaitForResponse: DoEvents
Debug.Print .getAllResponseHeaders
T = .ResponseText
'T = StrConv(.ResponseBody, vbUnicode)
End With
Debug.Print T
End Sub
- 이전글[vb6.0/vba] 특정 패턴으로 더하고 빼기(자화자찬) 19.10.20
- 다음글[vba] 웹 브라우저(Web browser) / InternetExplorer 를 이용한 네이버 검색 19.09.29
댓글목록
등록된 댓글이 없습니다.