SMS HTTP – API

HTTP

The HTTP API, uses a http request or post to communicate with smsNet.
To test this you can just enter this URL into your own browser to send the SMS.
Remeber this URL is just an exmpale and does not work since it has invalid username and password.

https://login.smsnet.se/send/?authorizationId=dXNlcm5hbWU6cGFzc3dvcmQ&destination=0709846366&type=text&text=Hello%20world&originator=Demo

The following params builds the http request:

Parameter Description
authorizationId* The 32 bit authorization token used to authenticat the request.
destination* a destination has to be provided, the phonenumber where you like to send your sms. Many SMS messages can be sent simultaneously with the separator;
type Type can be set to either text for regular text message or flash to be displayed directly on the cellphones display
text* The actual SMS text message
originator* Who sent the SMS, where was it from. Either a number or a string max 11 characters

If the message is received correct a message id will be return in the following format:
OK:

This is used to communicate the delivery report that can be setup for eatch API account.
The delivery report can look like this:

https://smsnet.se/delivery/?trackingid=92dff27302b754424242fb204620dc18&status=delivered

The following params builds the http request:

Parameter Description
trackingid* The
status* The status, that can be delivered,buffered or failed

Now some code examples:

In PHP:

<?php
// Sending simple message using PHP
$sms_url 	= "https://login.smsnet.se/send/";
$authorizationId= "authorizationId";
$type 		= "text";
$originator 	= 'smsNet';
$text           = "Hello world!";
$destination 	= "0709-846366";
	
$parameters  = "authorizationId=$authorizationId";
$parameters .= "&type=$type&originator=" . urlencode($originator);
$parameters .= "&destination=$destination&text=" . urlencode($text);
	
$response = file_get_contents($sms_url . "?" . $parameters,NULL,$sslContext);

if ($response === false) {
	echo "Kan ej skicka SMS korrekt!\n";
}elseif (substr($response, 0, 4) == "OK: ") {
	$trackingid = substr($response, 4);
	echo "\nSMS skickat med id: ".$trackingid."\n";
}elseif (substr($response, 0, 7) == "Error: ") {
	echo "Meddelandet har ej skickat följande fel har inträffat: " . $response."\n";
}