1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;

// Simple send SMS programm
public class SendSMS {
public static String sendSMS(String src, String dst, String type, String dr, String user, String password, String msg) {
String url;
StringBuilder inBuffer = new StringBuilder();
try {
url = "http://smsc.txtnation.com:8091/sms/send_sms.php" +
"?src=" + src + "&dst=" + dst + "&type=" + type +
"&dr=" + dr + "&user=" + user + "&password=" + pass + "&msg=" + URLEncoder.encode(msg, "UTF-8") ;
} catch (UnsupportedEncodingException e) {
return null;
}
try {
URL tmUrl = new URL(url);
URLConnection tmConnection = tmUrl.openConnection();
tmConnection.setDoInput(true);
BufferedReader in = new BufferedReader(new InputStreamReader(tmConnection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
inBuffer.append(inputLine);
in.close();
} catch (IOException e) {
return null;
}
return inBuffer.toString();
}
public static void main(String[] args) {
// Example of use
String response = sendSMS("447777000000", "447777111111", "0", "1","myUsername", "myPassword","My test message");
System.out.println(response);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

// Simple SMS send function
function sendSMS($src, $dst, $type, $dr, $username, $password, $message)
{
$params = [
'src' => $src,
'dst' => $dst,
'type' => $type,
'dr' => $dr,
'user' => $username,
'password' => $password,
'msg' => $message,
];

$url = sprintf('http://smsc.txtnation.com:8091/sms/send_sms.php?%s', http_build_query($params));

return file_get_contents($url);
}

// Example of use
$response = sendSMS('447777000000', '447777111111', '0', '0', 'myUsername', 'myPassword', 'My test message');
echo $response;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Web;

namespace SendSMS {
class Program {
public static string SendSMS(string src, string dst, string type, string dr, string user, string password, string msg) {
StringBuilder sb = new StringBuilder();
byte[] buf = new byte[1024];
string url = "http://smsc.txtnation.com:8091/sms/send_sms.php" +
"?src=" + src + "&dst=" + dst + "&type=" + type +
"&dr=" + dr + "&user=" + user + "&password=" + password + "&msg=" + HttpUtility.UrlEncode(message);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
do {
count = resStream.Read(buf, 0, buf.Length);
if (count != 0) {
tempString = Encoding.ASCII.GetString(buf, 0, count);
sb.Append(tempString);
}
}
while (count > 0);
return sb.ToString();
}
static void Main(string[] args) {
string respXML = SendSMS("447777000000", "447777111111", "0", "1","myUsername", "myPassword","My test message");
Console.WriteLine(respXML);
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <string>
#using <System.Dll>
#using <System.Web.Dll>

using namespace std;
using namespace System;
using namespace System::Web;
using namespace System::Net;
using namespace System::IO;
using namespace System::Runtime::InteropServices;

ref class SMSSender
{

private:
static String^ Username = "myUsername";
static String^ Password = "myPassword";

public:
SMSSender()
{}
String^ SendSMS(String^ src, String^ dst, String^ type, String^ dr, String^ user, String^ password, String^ msg)
{
Message = HttpUtility::UrlEncode(Message);
String^ URL = "http://smsc.txtnation.com:8091/sms/send_sms.php?&username=" + "?src=" + src + "&dst=" + dst + "&type=" + type +"&dr=" + dr + "&user=" + user + "&password=" + password + "&msg=" + Message;
WebRequest^ Handle = WebRequest::Create(URL);
WebResponse^ HTTPResponse = Handle->GetResponse();
StreamReader^ Stream = gcnew StreamReader(HTTPResponse->GetResponseStream());
String^ Response = Stream->ReadToEnd()->Trim();
HTTPResponse->Close();
return Response;
}
};

int main() {
SMSSender^ test = gcnew SMSSender();
String^ resp = test->SendSMS("447777000000", "447777111111", "0", "1","myUsername", "myPassword","My test message");
Console::WriteLine(resp);
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Imports System.Web

Module Module1
Public Function SendSMS(ByVal src As String, ByVal dst As String, ByVal type As String, ByVal dr As String,
ByVal user As String, ByVal password As String, ByVal msg As String)
Dim webClient As New System.Net.WebClient
Dim url As String = "http://smsc.txtnation.com:8091/sms/send_sms.php?src=" &
src & "&dst=" & dst & "&type=" & type & "&dr=" & dr & "&user=" & user & "&password=" & password
"&msg=" & System.Web.HttpUtility.UrlEncode(msg)
Dim result As String = webClient.DownloadString(url)
SendSMS = result
End Function

Sub Main()
Dim result As String = SendSMS("447777000000", "447777111111", "0", "1","myUsername", "myPassword","My test message")
Console.WriteLine(result)
Console.ReadKey()
End Sub

End Module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<%@ language="JScript" %>
<%
src="447777000000";
dst="447777111111";
type="0";
dr="1";
user="myUsername";
pass="myPassword";
message = Server.URLEncode("My test message");
url = "http://smsc.txtnation.com:8091/sms/send_sms.php?" + "&src=" + src + "&dst=" + dst + "&type=" + type + "&dr=" + dr + "&user=" + user + "&password=" + pass + "&msg=" + message;
var objSrvHTTP;
objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP");
objSrvHTTP.open(url, false);
objSrvHTTP.send();
Response.ContentType = "text/xml";
xmlResp = objSrvHTTP.responseXML.xml;
Response.Write(xmlResp);
%>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'net/http'
require 'uri'

def send_sms(src, dst, type, dr, user, password, msg)
requested_url = 'http://smsc.txtnation.com:8091/sms/send_sms.php?' +
"&src=" + src + "&dst=" + dst +
"&dr=" + dr + "&user=" + user +
"&password=" + password + "&type=" + type + "&msg=" + URI.escape(message) +
url = URI.parse(requested_url)
full_path = (url.query.blank?) ? url.path : "#{url.path}?#{url.query}"
the_request = Net::HTTP::Get.new(full_path)
the_response = Net::HTTP.start(url.host, url.port) { |http|
http.request(the_request)
}
raise "Response was not 200, response was #{the_response.code}" if the_response.code != "200"
return the_response.bodyend
resp = send_sms('447777000000', '447777111111', '0', '1','myUsername', 'myPassword','My test message')

puts(resp)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var http = require('http');

function getTestPersonaLoginCredentials(callback) {

return http.get({
host: 'http://smsc.txtnation.com',
path: '/sms/send_sms.php',
port: 8091,
qs:{
src:447777000000,
dst:447777111111,
dr:0,
user:'myUsername',
password: 'myPassword',
type:1,
msg:'test message'
}
}, function(response) {
// Continuously update stream with data
var body = '';
response.on('data', function(d) {
body += d;
});
response.on('end', function() {
callback(body);
});
});

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import urllib.parse
import urllib.request

url = 'http://smsc.txtnation.com:8091/sms/send_sms.php'
values = {
'src' : 447777000000,
'dst' : 447777111111,
'type' : 0,
'dr' : 1,
'user': 'myUsername',
'password' : 'myPassword',
'msg' : 'My test message.'
}
data = urllib.parse.urlencode(values).encode("utf-8")
req = urllib.request.Request(url, data)
response = urllib.request.urlopen(req)
the_page = response.read()
1
curl http://smsc.txtnation.com:8091/sms/send_sms.php?src=447777000000&dst=447777111111&dr=1&user=YOUR_USERNAME_HERE&password=YOUR_PASSWORD_HERE&type=0&msg=txtNation%20best%20to%20test%20at%20the%20end%20of%20the%20road