자료실

부자는 돈을 써서 시간을 아끼지만 가난한 사람은 시간을 써서 돈을 아낀다

vb.net

IT HUB를 찾아주셔서 감사합니다.

WinHttp [vb.net] 네이버 QR Code 단축 URL 생성(https/443)

페이지 정보

profile_image
작성자 하나를하더라도최선을
댓글 0건 조회 9,961회 작성일 20-07-02 02:51

본문

Private Function nhnQRLink(ByVal nhnID As StringByVal nhnCookie As StringByVal link As StringAs 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")
            Dim URL As String = "https://qr.naver.com/code/createForm.nhn"
            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""")
            URL = "https://qr.naver.com/code/createCode.nhn"
            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

댓글목록

등록된 댓글이 없습니다.