vb6.0/vba [vb6.0/vba] WinHttp 쿠키값 유지 및 갱신
페이지 정보
본문
Private Function CookieJoin(Cookie As String, ResponseHeaders) As String
Dim v As Variant, i As Integer, T As String
v = Split(Cookie, ";")
Dim O As Object
Set O = CreateObject("Scripting.Dictionary")
O.CompareMode = 1
For i = 0 To UBound(v)
v(i) = Trim(v(i))
T = Right(v(i), Len(v(i)) - InStr(v(i), "="))
O.Add Split(v(i), "=")(0), T
Next
v = Split(ResponseHeaders, "Set-Cookie:")
For i = 1 To UBound(v)
v(i) = Trim(v(i))
T = Split(v(i), ";")(0)
If O.Exists(Split(T, "=")(0)) Then
O(Split(T, "=")(0)) = Right(T, Len(T) - InStr(T, "="))
Else
O.Add Split(v(i), "=")(0), Right(T, Len(T) - InStr(T, "="))
End If
Next
ReDim v(0 To O.Count - 1)
Dim key As Variant
i = 0
For Each key In O.Keys
v(i) = Join(Array(key, O(key)), "=")
i = i + 1
Next
CookieJoin = Join(v, "; ")
End Function
- 이전글[vba] MSXML2.XMLHTTP.6.0 을 이용한 https://kr.investing.com/ 사이트의 443 포트 크롤링 19.09.28
- 다음글[vba] 찾는 글자에 색상을 주는 FIND VBA 19.09.28
댓글목록
등록된 댓글이 없습니다.