Private Function RandomCookie() As String
Dim rnd(19) As Byte
Dim r = New Random()
r.NextBytes(rnd)
Return BitConverter.ToString(rnd).Replace("-", "").ToLower()
End Function
Private Function SaveData(ByVal data As String, ByVal urlKey As String, ByVal padKey As String) As Boolean
Const url As String = "https://notepad.pw/save"
Dim postData As New Specialized.NameValueCollection()
postData.Add("key", padKey)
postData.Add("pad", data)
postData.Add("url", urlKey)
postData.Add("pw", "")
postData.Add("monospace", "0")
postData.Add("caret", "0")
Try
Dim wc As New WebClient()
wc.Encoding = Text.Encoding.UTF8
wc.Headers.Add(HttpRequestHeader.Cookie, "pad_cookie=" + RandomCookie())
wc.Headers.Add("X-Requested-With", "XMLHttpRequest")
wc.UploadValuesAsync(New Uri(url), postData)
Return True
Catch ex As Exception
MsgBox("Error: " & ex.Message)
Return False
End Try
End Function
Sub Main()
' Esempio di uso:
Dim testo As String = "text text text"
Dim ok As Boolean = SaveData(testo, "011hk762", "63958th7q")
If ok Then
MsgBox("OK!")
End If
End Sub