WinHttp [vb.net] WinHttp를 이용한 네이버 맞춤법 검사
페이지 정보
본문
Private Function SpellerProxy(ByVal value As String) As 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("Referer", "https://search.naver.com/search.naver?query=%EB%A7%9E%EC%B6%A4%EB%B2%95%20%EA%B2%80%EC%82%AC")
.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
- 이전글[vb.net] 암호화/복호화(Encrypt / Decrypt) 20.09.22
- 다음글[vb.net] DateTimePicker 표시형식 변경 20.09.15
댓글목록
등록된 댓글이 없습니다.