VB.NET

Afin d'envoyer des SMS en utilisant VB.NET (Visual Basic .NET), vous devez inclure dans votre projet les classes suivantes :

using System.Net;
using System.Web;
using System.Text;
using System.IO;

' DĂ©claration des variables. A MODIFIER
Dim username As String = "228xxxxxx" ' Votre nom d'utilisateur
Dim apikey As String = "xxxxxx" ' Votre cle API
Dim senderid As String = "ASPSMS" ' Identifiant d'envoi
Dim recipient As String = "228xxxxxx,228xxxxxx,228xxxxxx" ' Destinataire au format international
Dim msg As String = "Message Test VB.NET" ' Message
Dim authmode As String = "http" ' Obligatoire. Ne pas modifier

' Exécuter la requete. Ne modifier que si vous savez ce que vous faites
Dim request As WebRequest = WebRequest.Create("http://aspsmsapi.com/http/sendsms.aspx?")
request.Method = "POST"
Dim postData As String = "username=" + username & "&apikey=" + apikey & "&senderid=" + senderid & "&msg=" + msg & "&dest=" + recipient & "&authmode="+ authmode

Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
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()
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Console.WriteLine(responseFromServer)
reader.Close()
dataStream.Close()
response.Close()
The new disc fly replica watches collection series ladies watch incorporates many replica watch modern and fashionable aesthetic elements in the classic design. Available in 39mm and 36mm sizes, the watch is fake replica watches available in a variety of materials with replica rolex a rich palette of colours.