• 쇼핑몰
  • 커뮤니티
  • 북마크

vb6.0/vba




[vb6.0/vba] [vba] vba를 이용한 롯데택배 로그인 및 로그아웃

하나를하더라도최선을
2019.10.02 16:42 2,037 0

본문



4dd6692b7c6d0d60aafde60311a18ebd_1570002146_4944.png 

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
 
 


댓글목록 0

등록된 댓글이 없습니다.