WinHttp [vb.net] 네이버 QR Code 단축 URL 생성(https/443)
페이지 정보
본문
Private Function nhnQRLink(ByVal nhnID As String, ByVal nhnCookie As String, ByVal link As String) As String
Dim T As String = ""
Try
'ServicePointManager.Expect100Continue = True
'ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12 Or SecurityProtocolType.Ssl3
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim W As New WebClient
W.Headers.Add(HttpRequestHeader.Cookie, nhnCookie)
W.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0")
T = W.DownloadString(URL)
Dim qrCodePub As String = Split(Split(Split(T, "name=""qrCodePub""")(1), "value=")(1), """")(1)
Dim reqparm As New Specialized.NameValueCollection
reqparm.Add("qrNaverId", nhnID)
reqparm.Add("qrcdNo", "")
reqparm.Add("qrCodeUrl", "")
reqparm.Add("qrSaveStatusCd", "79")
reqparm.Add("qrColorBorderCd", "15")
reqparm.Add("qrDirectLinkTypeCd", "29")
reqparm.Add("qrDirectLink", UrlEncode(link))
reqparm.Add("qrSearchWord", "")
reqparm.Add("qrAttachOrder", "L%7CD%7CI%7CV%7CM%7CC")
reqparm.Add("qrSubjectFontTypeCd", "157")
reqparm.Add("qrLogoImgUrl", "")
reqparm.Add("qrLandingSkinTypeCd", "177")
reqparm.Add("qrAttachImgViewTypeCd", "164")
reqparm.Add("qrBorderSkinTypeCd", "237")
reqparm.Add("qrUserBorderSkinUrl", "")
reqparm.Add("qrCenterImgUrl", "")
reqparm.Add("qrLocation", "241")
reqparm.Add("qrUserBorderSkinThumbnailUrl", "")
reqparm.Add("qrCenterImgThumbnailUrl", "")
reqparm.Add("qrVersion", "30")
reqparm.Add("qrCodePub", qrCodePub)
reqparm.Add("qrCodeExp", "10001")
reqparm.Add("qrName", nhnID)
reqparm.Add("qrLogoTypeCd", "24")
reqparm.Add("qrSubject", "")
reqparm.Add("qrLocationTypeCd", "241")
reqparm.Add("qrKeepAttachOrderYn", "1")
reqparm.Add("qrAttachLinkList[0].linkSubject", "")
reqparm.Add("qrAttachLinkList[0].linkUrl", "")
reqparm.Add("qrAttachLinkList[1].linkSubject", "")
reqparm.Add("qrAttachLinkList[1].linkUrl", "")
reqparm.Add("qrAttachLinkList[2].linkSubject", "")
reqparm.Add("qrAttachLinkList[2].linkUrl", "")
reqparm.Add("qrAttachLinkList[3].linkSubject", "")
reqparm.Add("qrAttachLinkList[3].linkUrl", "")
reqparm.Add("qrAttachLinkList[4].linkSubject", "")
reqparm.Add("qrAttachLinkList[4].linkUrl", "")
reqparm.Add("qrDesc", "")
W.Headers.Add(HttpRequestHeader.Cookie, nhnCookie)
W.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0")
W.Headers.Add(HttpRequestHeader.Host, "qr.naver.com")
W.Headers.Add(HttpRequestHeader.Referer, "https://qr.naver.com/code/createForm.nhn")
Dim responsebytes = W.UploadValues(URL, "POST", reqparm)
Dim responsebody = (New Text.UTF8Encoding).GetString(responsebytes)
Clipboard.SetText(responsebody)
T = Split(Split(responsebody, """qrCodeUrl""")(1), """")(1)
Catch ex As Exception
End Try
Return T
End Function
- 이전글[vb.net] 웹 이미지를 vb.net 에서 불러오는 함수 20.08.29
- 다음글[vb.net] Http 비동기 샘플 : 비동기 및 대기를 사용한 비동기 프로그래밍 20.05.25
댓글목록
등록된 댓글이 없습니다.