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

vb6.0/vba




[vb6.0/vba] [vba] partners.coupang.com 에 WinHttp로 로그인 해서 상품정보 가져오기

하나를하더라도최선을
2020.09.22 23:37 49 0

본문




Sub login_coupang_com()
    Dim IE As Object
    Dim URL As String, Cookie As String, T As String
    Dim PostData As String
    Set IE = CreateObject("WinHttp.WinHttpRequest.5.1")
    
 
    With IE
        .Open "GET", URL
        .SetRequestHeader "Accept""text/html, application/xhtml+xml, image/jxr, */*"
        .SetRequestHeader "Accept-Language""ko"
        .SetRequestHeader "User-Agent""Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
        .SetRequestHeader "Host""login.coupang.com"
        .SetRequestHeader "Connection""Keep-Alive"
        .Send
        .WaitForResponse: DoEvents
        Debug.Print .GetAllResponseHeaders
    End With
    
    
    PostData = "email=이메일"
    PostData = PostData & "&password=비밀번호"
    PostData = PostData & "&rememberMe=false"
    PostData = PostData & "&token="
    PostData = PostData & "&captchaAnswer="
    PostData = PostData & "&returnUrl=https%25253A%25252F%25252Fpartners.coupang.com"
    PostData = PostData & "&fingerPrint=-540ko-KRArial%2CArial+Black%2CArial+Narrow%2C"
    PostData = PostData & "Arial+Rounded+MT+Bold%2CBook+Antiqua%2CBookman+Old+Style%2C"
    PostData = PostData & "Calibri%2CCambria%2CCambria+Math%2CCentury%2CCentury+Gothic%2C"
    PostData = PostData & "Century+Schoolbook%2CComic+Sans+MS%2CConsolas%2CCourier%2C"
    PostData = PostData & "Courier+New%2CGeorgia%2CHelvetica%2CImpact%2CLucida+Bright%2C"
    PostData = PostData & "Lucida+Calligraphy%2CLucida+Console%2CLucida+Fax%2CLucida+Handwriting%2C"
    PostData = PostData & "Lucida+Sans%2CLucida+Sans+Typewriter%2CLucida+Sans+Unicode%2C"
    PostData = PostData & "Microsoft+Sans+Serif%2CMonotype+Corsiva%2CMS+Gothic%2CMS+Outlook%2C"
    PostData = PostData & "MS+PGothic%2CMS+Reference+Sans+Serif%2CMS+Sans+Serif%2CMS+Serif%2C"
    PostData = PostData & "Palatino+Linotype%2CSegoe+Print%2CSegoe+Script%2CSegoe+UI%2CSegoe+UI+Light%2C"
    PostData = PostData & "Segoe+UI+Semibold%2CSegoe+UI+Symbol%2CTahoma%2CTimes%2CTimes+New+Roman%2C"
    PostData = PostData & "Trebuchet+MS%2CVerdana%2CWingdings%2CWingdings+2%2CWingdings+3ca1ccd9c150777c"
    PostData = PostData & "be1a117a431f0ff46not+availablenot+availableaudio%2Fmpeg%3A+maybe%2Caudio%2Fmp4%3B+codecs%3D%22mp4a.40.2%22%3A+probably"
    With IE
        .Open "POST", URL
        .SetRequestHeader "Content-Type""application/x-www-form-urlencoded; charset=UTF-8"
        .SetRequestHeader "Accept""*/*"
        .SetRequestHeader "X-Requested-With""XMLHttpRequest"
        .SetRequestHeader "Accept-Language""ko"
        .SetRequestHeader "User-Agent""Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
        .SetRequestHeader "Host""login.coupang.com"
        .SetRequestHeader "Connection""Keep-Alive"
        .SetRequestHeader "Cache-Control""no-cache"
        .SetRequestHeader "Content-Length", Len(PostData)
        .Send PostData
        .WaitForResponse: DoEvents
        Debug.Print .GetAllResponseHeaders
    End With
 
    '// 상품검색
    PostData = "{""page"":{""pageNumber"":1,""size"":100},""filter"":""검색어"",""deliveryTypes"":[]}"
    With IE
        .Open "POST", URL
        .SetRequestHeader "Accept""application/json, text/plain, */*"
        .SetRequestHeader "Content-Type""application/json;charset=utf-8"
        .SetRequestHeader "lang""ko"
        .SetRequestHeader "Referer""https://partners.coupang.com/"
        .SetRequestHeader "Accept-Language""ko"
        .SetRequestHeader "User-Agent""Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
        .SetRequestHeader "Host""partners.coupang.com"
        .SetRequestHeader "Connection""Keep-Alive"
        .SetRequestHeader "Cache-Control""no-cache"
        .SetRequestHeader "Content-Length", Len(PostData)
        .Send PostData
        .WaitForResponse: DoEvents
        T = .ResponseText
    End With
    Debug.Print T
End Sub


아래와 같이 JSON 형식이다.





댓글목록 0

등록된 댓글이 없습니다.