vb6.0/vba [vb6.0/vba] WinHttp를 이용한 구글 이미지 검색
페이지 정보
본문
Sub program1472_com()
Dim URL As String, T As String
URL = "https://www.google.com/search?q=허벌 라이프&tbm=isch"
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", URL
.SetRequestHeader "accept-language", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7"
.SetRequestHeader "dpr", "1"
.SetRequestHeader "sec-fetch-dest", "document"
.SetRequestHeader "sec-fetch-mode", "navigate"
.SetRequestHeader "sec-fetch-site", "none"
.SetRequestHeader "upgrade-insecure-requests", "1"
.SetRequestHeader "user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
' .SetRequestHeader "x-client-data", "CJO2yQEIprbJAQjEtskBCKmdygEIy67KAQjQr8oBCLywygEIl7XKAQjttcoBCI66ygE="
.Send
.WaitForResponse: DoEvents
T = .ResponseText
'T = StrConv(.ResponseBody, vbUnicode)
End With
Debug.Print UnicodeToString(T)
End Sub
Function UnicodeToString(Text As String) As String
Dim V As Variant, str As String
Dim T As String, tem As String, ret As String
On Error Resume Next
For Each V In Split(Text, "\u")
If Len(V) >= 4 Then
tem = Right(V, Len(V) - 4)
str = ToString(Left(V, 4))
ret = ret & str & tem
Else
ret = ret & V
End If
Next
UnicodeToString = ret
End Function
Function ToString(Text As String) As String
On Error GoTo ErrPass
ToString = ChrW("&H" & Text)
Exit Function
ErrPass:
ToString = Text
End Function
- 이전글[vb6.0/vba]유니코드를 일반 문자열로 변환시켜주는 vb6.0/vba 사용자 함수 20.04.10
- 다음글[vba] WinHttp 파일 다운로드 20.04.10
댓글목록
등록된 댓글이 없습니다.