Send SMS
This API feature will give you the ability to send SMS messages to single or multiple receivers using the same API. All API's accept GET and POST requests.
The base URL to use for this service is https://my.libyasms.com/. The base URL cannot be used on its own; you must append a path that identifies an operation and you may have to specify some path parameters as well.
Parameters
| Parameter | Value | Required |
|---|---|---|
| apikey | apikey provided by Libya SMS | Yes |
| secretkey | secretkey provided by Libya SMS | Yes |
| callerID | your approved sender id | Yes |
| toUser | Semicolon separated receivers' phone numbers including country codes without + or 00, for example: 218915063556,218925063556 with no space between numbers |
Yes |
| messageContent | SMS text message contents | Yes |
Request
Dim URL ="https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello World"
Try
Dim request as WebRequest = WebRequest.Create(URL)
Dim response As WebResponse = request.GetResponse()
Dim dataStream As Stream = response.GetResponseStream()
Dim SR As New StreamReader(dataStream)
Dim str As String
str = SR.ReadToEnd()
Console.WriteLine(str)
response.Close()
Catch ex As System.Net.WebException
Console.WriteLine(ex.Message)
End Try
var client = new RestClient("https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello World");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var request = http.Request('GET', Uri.parse('https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello World'));
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello%20World',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello World")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
import http.client
conn = http.client.HTTPSConnection("https://my.libyasms.com", 443)
payload = ''
headers = {}
conn.request("GET", "/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello%20World", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "net/http"
url = URI("https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello World")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://my.libyasms.com/sendtext?apikey=7969ea24f713e424&secretkey=c7fba893&callerID=LibyaSMS&toUser=218915063556&messageContent=Hello World")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()