VB.NET SMS send code

Full screen VB.NET Topic list Imports System.Web Imports System.IO Imports System.Net Imports System.Text Imports System.Resources Public Class sendSMS Public Function sendSMS() Dim uname = "youremail@address.com" Dim hash = "Your API hash" Dim message = "This is your message" Dim numbers = "447123456789" Dim strPost As String Dim sender = "Jims Autos" Dim url As String = "http://api.txtlocal.com/send/?" Dim strPost As String strPost = url + "username=" + uname _ + "&hash=" + hash _ + "&numbers=" + numbers _ + "&message=" + WebUtility.UrlEncode(message) _ + "&sender=" + sender Dim request As WebRequest = WebRequest.Create(strPost) request.Method = "POST" Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strPost) request.ContentType = "application/x-www-form-urlencoded" request.ContentLength = byteArray.Length Dim dataStream As Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = request.GetResponse() dataStream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() Console.WriteLine(responseFromServer) Console.ReadLine() reader.Close() dataStream.Close() response.Close() If responseFromServer.Length > 0 Then Return responseFromServer Else Return CType(response, HttpWebResponse).StatusDescription Return CType(response, HttpWebResponse).StatusDescription End If End Function End Class Copyright © 2015-19 Allied Factors Limited. All Rights Reserved.