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

vb.net




[WinHttp] [vb.net] WinHttp를 이용한 네이버 맞춤법 검사

하나를하더라도최선을
2020.09.22 22:56 104 0

본문



    Private Function SpellerProxy(ByVal value As StringAs String
        Dim URL As String, T As String
        URL &= "_callback=jQuery1124027291531983561435_" & UNIX_TIME()
        URL &= "&q=" & UrlEncode(value)
        URL &= "&where=nexearch"
        URL &= "&color_blindness=0"
        URL &= "&_=" & UNIX_TIME()
        With CreateObject("WinHttp.WinHttpRequest.5.1")
            .Open("GET", URL)
            .SetRequestHeader("Host""m.search.naver.com")
            .SetRequestHeader("User-Agent""Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.9 Safari/537.36")
            .SetRequestHeader("Accept""*/*")
            .SetRequestHeader("Accept-Language""ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3")
            .SetRequestHeader("Connection""keep-alive")
            If Len(Cookie) Then .SetRequestHeader("Cookie", Cookie)
            .Send()
            .WaitForResponse() : Application.DoEvents()
            T = .ResponseText
        End With
        T = T.Substring(T.IndexOf("{"))
        T = T.Substring(0, T.Length - 2)
        Dim O As Object = JsonConvert.DeserializeObject(T)
        T = O("message")("result")("notag_html")
        Do While T.IndexOf("<br><br>"> -1
            T = T.Replace("<br><br>""<br>")
        Loop
        Return T.Replace("<br>", vbCrLf)
    End Function

 






댓글목록 0

등록된 댓글이 없습니다.