Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim txt As String = ""
txt = DateTimePicker1.Value.ToLongDateString & vbNewLine & RichTextBox1.Text.Replace("'", "''")
Dim arg As String
arg = "-X POST -H ""Authorization: Bearer " & TextBox1.Text & """ -F ""message='" & txt & "'"" https://notify-api.line.me/api/notify"
ShellandWait("curl.exe", arg)
End Sub
Public Sub ShellandWait(ByVal ProcessPath As String, ByVal Arguments As String)
Dim objProcess As System.Diagnostics.Process
Try
objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.Arguments = Arguments
objProcess.StartInfo.FileName = ProcessPath
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
objProcess.Start()
Application.DoEvents()
objProcess.WaitForExit()
Application.DoEvents()
Console.WriteLine(objProcess.ExitCode.ToString())
objProcess.Close()
Catch ex As Exception
MsgBox("Could not start process " & ProcessPath & " " & ex.StackTrace.ToString)
End Try
End Sub
Function EncodeUTF8(ByRef Str As String) As String
Dim latinEnc As Encoding = Encoding.GetEncoding("UTF-8")
Dim thaiEnc As Encoding = Encoding.GetEncoding("TIS-620")
Dim bytes As Byte() = latinEnc.GetBytes(Str)
Dim textResult As String = thaiEnc.GetString(bytes)
Return textResult
End Function