HTTP Credits Link
https://api.sendmode.co.za/httppost.aspx?Type=credits&username=xxx&password=yyy
https://api.sendmode.co.za/httppost.aspx?Type=credits&username=xxx&password=yyy
The return object looks like:
<api_result>
<data>
<credits>xxxxx</credits>
</data>
<call_result>
<result>True</result>
<error />
</call_result>
</api_result>
Your current credit value will be displayed between the "credits" tag.
https://api.sendmode.co.za/httppost.aspx?Type=sendparam&username=xxx&password=yyy&numto=27871234567&data1=mytestmsg
The output of the following will be defined by the input of the above parameters:
<httppost_result>
<call_result>
<result>True</result>
<error></error>
</call_result>
</httppost_result>
JAVA Code Example - Sending SMS
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
public class SMSClient {
public static String sendSMS(String username, String password, String recipient, String message) {
try {
String urlStr = String.format(
"https://api.sendmode.co.za/httppost.aspx?username=%s&password=%s&numto=%s&data1=%s",
URLEncoder.encode(username, "UTF-8"),
URLEncoder.encode(password, "UTF-8"),
URLEncoder.encode(senderId, "UTF-8"),
URLEncoder.encode(recipient, "UTF-8"),
URLEncoder.encode(message, "UTF-8")
);
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
conn.disconnect();
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return "Error sending SMS: " + e.getMessage();
}
}
public static void main(String[] args) {
String response = sendSMS("your_username", "your_password", "recipient_number", "Your message content");
System.out.println(response);
}
}
PHP Code Example - Sending SMS
<?php
function SendSMS($username, $password, $senderId, $recipient, $message) {
$url = 'https://api.sendmode.com.za/httppost.aspx?' . http_build_query([
'username' => $username,
'password' => $password,
'numto' => $recipient,
'data1' => $message
]);
$response = file_get_contents($url);
return $response;
}
// Example usage
$response = SendSMS('your_username', 'your_password', 'recipient_number', 'Your message content');
echo $response;
?>
C# Code Example - Sending SMS
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class SMSClient
{
private static readonly HttpClient client = new HttpClient();
public static async Task<string> SendSMS(string username, string password, string recipient, string message)
{
string url = $"https://api.sendmode.co.za/httppost.aspx?username={username}&password={password}&numto={recipient}&data1={Uri.EscapeDataString(message)}";
HttpResponseMessage response = await client.GetAsync(url);
return await response.Content.ReadAsStringAsync();
}
public static async Task Main(string[] args)
{
string response = await SendSMS("your_username", "your_password", "recipient_number", "Your message content");
Console.WriteLine(response);
}
}
HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost("https://rest.sendmode.com/v2/hlr");
httppost.setHeader(HttpHeaders.AUTHORIZATION, YOUR_ACCESS_KEY);
List<NameValuePair> params = new ArrayList<NameValuePair>(1);
params.add(new BasicNameValuePair("mobilenumber", "0870000000"));
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost("https://rest.sendmode.com/v2/END_POINT");
httppost.setHeader(HttpHeaders.AUTHORIZATION, YOUR_ACCESS_KEY);
$url = 'https://rest.sendmode.com/v2/END_POINT';
$data = array(YOUR_DATA);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n" .
"Authorization: YOUR_ACCESS_KEY\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);