Contacts   02 40 70 72 40
IT IT flag-down
PROVA GRATIS         ACCEDI

Esempi di codice

Qui puoi copiare e incollare gli esempi di codice delle nostre API per essere pronto subito ad inviare SMS!

Esempi Invio SMS

Di seguito trovi una selezione di esempi che puoi copiare e modificare a piacere. Se necessiti di aiuto contattaci
Copy to clipboard


  • <?php
    define("NET_ERROR", "Errore+di+rete+impossibile+spedire+il+messaggio");
    define("SENDER_ERROR", "Puoi+specificare+solo+un+tipo+di+mittente%2C+numerico+o+alfanumerico");
    
    define ("SMS_TYPE_CLASSIC", "classic");
    define ("SMS_TYPE_CLASSIC_PLUS", "classic_plus");
    define ("SMS_TYPE_BASIC", "basic");
    define ("SMS_TYPE_TEST_CLASSIC", "test_classic");
    define ("SMS_TYPE_TEST_CLASSIC_PLUS", "test_classic_plus");
    define ("SMS_TYPE_TEST_BASIC", "test_basic");
    
    
    function do_post_request($url, $data, $optional_headers = null){
    	if(!function_exists('curl_init')) {
    		$params = array(
    			'http' => array(
    				'method' => 'POST',
    				'content' => $data
    			)
    		);
    		if ($optional_headers !== null) {
    			$params['http']['header'] = $optional_headers;
    		}
    		$ctx = stream_context_create($params);
    		$fp = @fopen($url, 'rb', false, $ctx);
    		if (!$fp) {
    			return 'status=failed&message='.NET_ERROR;
    		}
    		$response = @stream_get_contents($fp);
    		if ($response === false) {
    			return 'status=failed&message='.NET_ERROR;
    		}
    		return $response;
    	} else {
    		$ch = curl_init();
    		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);
    		curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    		curl_setopt($ch,CURLOPT_TIMEOUT,60);
    		curl_setopt($ch,CURLOPT_USERAGENT,'Generic Client');
    		curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
    		curl_setopt($ch,CURLOPT_URL,$url);
    
    		if ($optional_headers !== null) {
    			curl_setopt($ch,CURLOPT_HTTPHEADER,$optional_headers);
    		}
    
    		$response = curl_exec($ch);
    		curl_close($ch);
    		if(!$response){
    			return 'status=failed&message='.NET_ERROR;
    		}
    		return $response;
    	}
    }
    
    function skebbyGatewaySendSMS($username,$password,$recipients,$text,$sms_type=SMS_TYPE_CLASSIC,$sender_number='',$sender_string='',$user_reference='',$charset='',$optional_headers=null) {
    	$url = 'http://gateway.skebby.it/api/send/smseasy/advanced/http.php';
    
    	if (!is_array($recipients)){
    		$recipients = array($recipients);
    	}
    
    	switch($sms_type) {
    		case SMS_TYPE_CLASSIC:
    		default:
    			$method='send_sms_classic';
    			break;
    		case SMS_TYPE_CLASSIC_PLUS:
    			$method='send_sms_classic_report';
    			break;
    		case SMS_TYPE_BASIC:
    			$method='send_sms_basic';
    			break;
    		case SMS_TYPE_TEST_CLASSIC:
    			$method='test_send_sms_classic';
    			break;
    		case SMS_TYPE_TEST_CLASSIC_PLUS:
    			$method='test_send_sms_classic_report';
    			break;
    		case SMS_TYPE_TEST_BASIC:
    			$method='test_send_sms_basic';
    			break;
       }
    
    	$parameters = 'method='
    				  .urlencode($method).'&'
    				  .'username='
    				  .urlencode($username).'&'
    				  .'password='
    				  .urlencode($password).'&'
    				  .'text='
    				  .urlencode($text).'&'
    				  .'recipients[]='.implode('&recipients[]=',$recipients)
    				  ;
    				  
    	if($sender_number != '' && $sender_string != '') {
    		parse_str('status=failed&message='.SENDER_ERROR,$result);
    		return $result;
    	}
    	$parameters .= $sender_number != '' ? '&sender_number='.urlencode($sender_number) : '';
    	$parameters .= $sender_string != '' ? '&sender_string='.urlencode($sender_string) : '';
    
    	$parameters .= $user_reference != '' ? '&user_reference='.urlencode($user_reference) : '';
    
    	
    	switch($charset) {
    		case 'UTF-8':
    			$parameters .= '&charset='.urlencode('UTF-8');
                break;
    		case '':
    		case 'ISO-8859-1':
    		default:
                break;
    	}
    	
    	parse_str(do_post_request($url,$parameters,$optional_headers),$result);
    
    	return $result;
    }
    
    function skebbyGatewayGetCredit($username,$password,$charset=''){
    	$url = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php";
    	$method = "get_credit";
    	
    	$parameters = 'method='
    				.urlencode($method).'&'
                    .'username='
                    .urlencode($username).'&'
                    .'password='
                    .urlencode($password);
    				
    	switch($charset) {
    		case 'UTF-8':
    			$parameters .= '&charset='.urlencode('UTF-8');
    			break;
    		default:
    	}
    	
    	parse_str(do_post_request($url,$parameters),$result);
    	return $result;
    }
    
    // Invio singolo
    $recipients = array('393471234567');
    
    // Per invio multiplo
    // $recipients = array('393471234567','393497654321');
    
    
    // ------------ Invio SMS Classic --------------
    
    // Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
     $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_CLASSIC,'','John');
    
    // Invio SMS CLASSIC con mittente personalizzato di tipo numerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_CLASSIC,'393471234567');
    
    
    // ------------- Invio SMS Basic ----------------
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you? By John', SMS_TYPE_BASIC);
    
    
    // ------------ Invio SMS Classic Plus -----------
    
    // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_CLASSIC_PLUS,'','John');
    
    // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_CLASSIC_PLUS,'393471234567');
    
    // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico e stringa di riferimento personalizzabile
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_CLASSIC_PLUS,'393471234567','','riferimento');
    
    
    
    
    // ------------------------------------------------------------------
    // ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
    // SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
    // ------------------------------------------------------------------
    
    // ------------- Testing invio SMS Classic---------
    // TEST di invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_TEST_CLASSIC,'','John');
    
    // TEST di invio SMS CLASSIC con mittente personalizzato di tipo numerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_TEST_CLASSIC,'393471234567');
    
    // ------------- Testing invio SMS Classic Plus---------
    
    // TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_TEST_CLASSIC_PLUS,'','John');
    
    // TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you?', SMS_TYPE_TEST_CLASSIC_PLUS,'393471234567');
    
    // ------------- Testing invio SMS Basic---------------
    // $result = skebbyGatewaySendSMS('username','password',$recipients,'Hi Mike, how are you? By John', SMS_TYPE_TEST_BASIC);
    
    // ------------------------------------------------------------------
    // ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
    // SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
    // ------------------------------------------------------------------
    
    
    
    
    if($result['status']=='success') {
    	echo '<b style="color:#8dc63f;">SMS inviato con successo</b><br/>';
    	if (isset($result['remaining_sms'])){
    		echo '<b>SMS rimanenti:</b>'.$result['remaining_sms'];
    	}
    	if (isset($result['id'])){
    		echo '<b>ID:</b>'.$result['id'];
    	}
    }
    
    // ------------------------------------------------------------------
    // Controlla la documentazione completa all'indirizzo http://www.skebby.it/business/index/send-docs/ 
    // ------------------------------------------------------------------
    // Per i possibili errori si veda http://www.skebby.it/business/index/send-docs/#errorCodesSection
    // ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    // ------------------------------------------------------------------
    if($result['status']=='failed')	{
    	echo '<b style="color:#ed1c24;">Invio fallito</b><br/>';
    	if(isset($result['code'])) {
    		echo '<b>Codice:</b>'.$result['code'].'<br/>';
    	}
    		echo '<b>Motivo:</b>'.urldecode($result['message']);
    }
    
    
    // ------------ Controllo del CREDITO RESIDUO -------------
    // $credit_result = skebbyGatewayGetCredit('username', 'password');
    
    
    // if($credit_result['status']=='success') {
      // echo 'Credito residuo: ' .$credit_result['credit_left']."\n";
      // echo 'SMS Classic rimanenti: ' .$credit_result['classic_sms']."\n";
      // echo 'SMS Basic rimanenti: ' .$credit_result['basic_sms']."\n";
    // }
    
    // if($credit_result['status']=='failed') {
      // echo 'Invio richiesta fallito';
    // }
    
    ?>					

  • <%
    Const SENDER_ERROR="Puoi specificare solo un tipo di mittente, numerico o alfanumerico"
    
    function skebbyGatewaySendSMS(username,password,recipients,text,sms_type,sender_number,sender_string,charset)
    	url = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
    	method = ""
    	select case sms_type
    		case "classic"
    			method = "send_sms_classic"
    		case "report"
    			method = "send_sms_classic_report"
    		case else
    			method = "send_sms_basic"
    	end select
    
    	parameters = "method=" & Server.urlencode(method) & "&" _
    				& "username=" & Server.urlencode(username) & "&" _
    				& "password=" & Server.urlencode(password) & "&" _
    				& "text=" & Server.urlencode(text) & "&" _
    				& "recipients[]=" & join(recipients,"&recipients[]=")
    
    	if sender_number <> "" And sender_string <> "" then
    		skebbyGatewaySendSMS = "status=failed&message=" & SENDER_ERROR
    		exit function
    	end if
    
    	if sender_number <> "" then parameters = parameters & "&sender_number=" & Server.urlencode(sender_number)
    	if sender_string <> "" then parameters = parameters & "&sender_string=" & Server.urlencode(sender_string)
    
    	select case charset
    		case "UTF-8"
    			parameters = parameters & "&charset=" & Server.urlencode("UTF-8")
    		case else
    	end select
    
    	set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
    	xmlhttp.open "POST", url, false
    	xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    	xmlhttp.setRequestHeader "Content-Length", Len(parameters)
    	xmlhttp.Send parameters 
    
    	If xmlhttp.Status >= 400 And xmlhttp.Status <= 599 Then
    		skebbyGatewaySendSMS = "status=failed&message=" & xmlhttp.Status & " - " & xmlhttp.statusText
    		exit function
    	End If
    
    	msg = xmlhttp.responseText
    	set xmlhttp = nothing
    
    	skebbyGatewaySendSMS = msg
    end function
    
    Dim recipients
    Dim i
    
    ' Invio singolo
    recipients = array("393471234567")
    
    ' Per invio multiplo
    ' recipients = array("393471234567","393497654321")
    
    ' ------------------------------------------------------------------
    ' Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    ' ------------------------------------------------------------------
    ' Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    ' ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    ' ------------------------------------------------------------------	
    
    ' Invio SMS Classic con mittente personalizzato di tipo alfanumerico
    result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?","classic","","John","")
    
    ' Invio SMS Basic
    ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?","basic","","","")
    
    ' Invio SMS Classic con mittente personalizzato di tipo numerico
    ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?","classic","393471234567","","")
    
    ' Invio SMS Classic con notifica(report) con mittente personalizzato di tipo alfanumerico - Invio SMS Classic Plus 
    ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?","report","","John","")
    
    ' Invio SMS Classic con notifica(report) con mittente personalizzato di tipo numerico - Invio SMS Classic Plus
    ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?","report","393471234567","","")
    
    responses = split(result,"&")
    
    for each item in responses
    	Response.write item & "<br/>"
    next
    
    %>					

  • Const SMS_TYPE_CLASSIC As String = "classic"
    Const SMS_TYPE_CLASSIC_PLUS As String = "classic_plus"
    Const SMS_TYPE_BASIC As String = "basic"
    Const SMS_TYPE_TEST_CLASSIC As String = "test_classic"
    Const SMS_TYPE_TEST_CLASSIC_PLUS As String = "test_classic_plus"
    Const SMS_TYPE_TEST_BASIC As String = "test_basic"
    
    Function URLEncode(ByVal Text As String) As String
    
    	Dim i As Integer
    	Dim acode As Integer
    	Dim chr As String
    	Dim hexValue As String
    	Dim finalString As String
    
    	finalString = ""
    
    	For i = 1 To Len(Text) Step 1
    		acode = Asc(Mid$(Text, i, 1))
    		Select Case acode
    			Case 48 To 57, 65 To 90, 97 To 122
    				' don't touch alphanumeric chars
    				finalString = finalString & Mid$(Text, i, 1)
    			Case 32
    				' replace space with "+"
    				'Mid$(Text, i, 1) = "+"
    				finalString = finalString & "+"
    			Case Else
    				hexValue = Hex$(acode)
    				Select Case Len(hexValue)
    					Case 1
    						hexValue = "0" & hexValue
    					Case 2
    						'ok
    					Case Else
    						'carattere non valido
    						'skip
    						hexValue = ""
    				End Select
    				
    				' replace punctuation chars with "%hex"
    				finalString = finalString & "%" & hexValue
    
    
    		End Select
    	Next
    	Return finalString
    End Function
    
    
    Function skebbyGatewaySendSMS(username As String, password As String, recipients() As String, Text As String, sms_type As String, Optional sender_number As String = "", Optional sender_string As String = "", Optional user_reference As String = "", Optional charset As String = "") As String
    	Dim sender_error, url, method, parameters, msg As String
    
    	Dim xmlhttp As Object
    	xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    
    
    	url = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
    	sender_error = "Puoi specificare solo un tipo di mittente, numerico o alfanumerico"
    	method = "send_sms_classic"
    
    	Select Case sms_type
    		Case SMS_TYPE_CLASSIC
    			method = "send_sms_classic"
    		Case SMS_TYPE_CLASSIC_PLUS
    			method = "send_sms_classic_report"
    		Case SMS_TYPE_BASIC
    			method = "send_sms_basic"
    		Case SMS_TYPE_TEST_CLASSIC
    			method = "test_send_sms_classic"
    		Case SMS_TYPE_TEST_CLASSIC_PLUS
    			method = "test_send_sms_classic_report"
    		Case SMS_TYPE_TEST_BASIC
    			method = "test_send_sms_basic"
    		Case Else
    			method = "send_sms_classic"
    	End Select
    
    	parameters = "method=" & method & "&" _
    				 & "username=" & URLEncode(username) & "&" _
    				 & "password=" & URLEncode(password) & "&" _
    				 & "text=" & URLEncode(Text) & "&" _
    				 & "recipients[]=" & Join(recipients, "&recipients[]=")
    
    	If sender_number <> "" And sender_string <> "" Then
    		skebbyGatewaySendSMS = "status=failed&message=" & sender_error
    		Exit Function
    	End If
    
    	If sender_number <> "" Then parameters = parameters & "&sender_number=" & URLEncode(sender_number)
    	If sender_string <> "" Then parameters = parameters & "&sender_string=" & URLEncode(sender_string)
    
    	If user_reference <> "" Then parameters = parameters & "&user_reference=" & URLEncode(user_reference)
    
    	Select Case charset
    		Case "UTF-8"
    			parameters = parameters & "&charset=UTF-8"
    		Case Else
    	End Select
    
    
    
    	xmlhttp.open("POST", url, False)
    	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    	xmlhttp.setRequestHeader("Content-Length", Len(parameters))
    	xmlhttp.Send(parameters)
    
    	If xmlhttp.Status >= 400 And xmlhttp.Status <= 599 Then
    		skebbyGatewaySendSMS = "status=failed&message=" & xmlhttp.Status & " - " & xmlhttp.statusText
    		Exit Function
    	End If
    
    	' ------------------------------------------------------------------
    	' Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    	' ------------------------------------------------------------------
    	' Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    	' ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    	' ------------------------------------------------------------------    
    
    	msg = xmlhttp.responseText
    	xmlhttp = Nothing
    
    	skebbyGatewaySendSMS = msg
    
    End Function
    
    Function skebbyGatewayGetCredit(username As String, password As String, Optional charset As String = "") As String
    	Dim url, method, parameters, msg As String
    	Dim xmlhttp As Object
    	xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    
    	url = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
    	method = "get_credit"
    
    	parameters = "method=" & method & "&" _
    				 & "username=" & URLEncode(username) & "&" _
    				 & "password=" & URLEncode(password)
    
    	Select Case charset
    		Case "UTF-8"
    			parameters = parameters & "&charset=UTF-8"
    		Case Else
    	End Select
    
    
    
    	xmlhttp.open("POST", url, False)
    	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    	xmlhttp.setRequestHeader("Content-Length", Len(parameters))
    	xmlhttp.Send(parameters)
    
    	If xmlhttp.Status >= 400 And xmlhttp.Status <= 599 Then
    		skebbyGatewayGetCredit = "status=failed&message=" & xmlhttp.Status & " - " & xmlhttp.statusText
    		Exit Function
    	End If
    
    	msg = xmlhttp.responseText
    	xmlhttp = Nothing
    
    	skebbyGatewayGetCredit = msg
    
    End Function
    
    
    Private Sub Form_Load()
    
    	Dim recipients(0) As String
    	Dim i As Integer
    
    	' Invio singolo
    	recipients(0) = "393471234567"
    
    	' Per invio multiplo
    	' recipients(0) = "393471234567"
    	' recipients(1) = "393497654321"
    
    	' ------------ Invio SMS Classic --------------
    
    	' Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
    	Dim result As String
    	result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC,"","John")
    
    	' Invio SMS CLASSIC con mittente personalizzato di tipo numerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC,"393471234567")
    
    
    	' ------------- Invio SMS Basic ----------------
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you? By John", SMS_TYPE_BASIC)
    
    
    	' ------------ Invio SMS Classic Plus -----------
    
    	' Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"","John")
    
    	' Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"393471234567")
    
    	' Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico e stringa di riferimento personalizzabile
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"393471234567","","riferimento")
    
    
    
    	' ------------------------------------------------------------------
    	' ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
    	' SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
    	' ------------------------------------------------------------------
    
    	' ------------- Testing invio SMS Classic---------
    
    	' TEST di invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC,"","John")
    
    	' TEST di invio SMS CLASSIC con mittente personalizzato di tipo numerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC,"393471234567")
    
    
    	' ------------- Testing invio SMS Classic Plus---------
    
    	' TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC_PLUS,"","John")
    
    	' TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC_PLUS,"393471234567")
    
    
    	' ------------- Testing invio SMS Basic---------------
    	' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you? By John", SMS_TYPE_TEST_BASIC)
    
    	' ------------------------------------------------------------------
    	' ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
    	' SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
    	' ------------------------------------------------------------------
    
    
    
    	' ------------ Controllo del CREDITO RESIDUO -------------
    	' result = skebbyGatewayGetCredit("username", "password")
    
    
    	Dim responses As String()
    	responses = Split(result, "&")
    	Dim Response As String = ""
    	For Each Item In responses
    		Response = Response & Item & vbCrLf
    	Next
    	MsgBox(Response, vbOKOnly + vbInformation, "Result")
    	
    End Sub					

  • using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Text;
    using System.Net;
    using System.IO;
    using System.Web;
    
    
    namespace ConsoleApplication1
    {
        class Program
        {
    
            public const string SMS_TYPE_CLASSIC = "classic";
            public const string SMS_TYPE_CLASSIC_PLUS = "classic_plus";
            public const string SMS_TYPE_BASIC = "basic";
            public const string SMS_TYPE_TEST_CLASSIC = "test_classic";
            public const string SMS_TYPE_TEST_CLASSIC_PLUS = "test_classic_plus";
            public const string SMS_TYPE_TEST_BASIC = "test_basic";
    
    
            static void Main(string[] args)
            {
                // Invio singolo
                String[] recipients = new String[] { "393471234567" };
    
                // Per invio multiplo
                // String[] recipients = new String[] { "393471234567", "393477654321" };
    
                Hashtable result = new Hashtable();
                Hashtable credit_result = new Hashtable();
                String line;
    
                // ------------ Invio SMS Classic --------------
    
                // Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
                   result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_CLASSIC, "", "John","","");
    
                // Invio SMS CLASSIC con mittente personalizzato di tipo numerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC,"393471234567","","","");
    
                // ------------- Invio SMS Basic ----------------
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you? By John", SMS_TYPE_BASIC, "", "","","");
    
                // ------------ Invio SMS Classic Plus -----------
    
                // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"","John","","");
    
                // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"393471234567","","","");
    
                // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico e stringa di riferimento personalizzabile
                // result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS, "393471234567", "", "riferimento", "");
    
    
                // ------------------------------------------------------------------
                // ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
                // SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
                // ------------------------------------------------------------------
    
                // ------------- Testing invio SMS Classic---------
    
                // TEST di invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC,"","John","","");
    
                // TEST di invio SMS CLASSIC con mittente personalizzato di tipo numerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC,"393471234567","","","");
    
    
                // ------------- Testing invio SMS Classic Plus---------
    
                // TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC_PLUS,"","John","","");
    
                // TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC_PLUS,"393471234567","","","");
    
    
                // ------------- Testing invio SMS Basic---------------
                // result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you? By John", SMS_TYPE_TEST_BASIC,"","","","");
    
                if ((string)result["status"] == "success")
                {
                    Console.WriteLine("SMS inviato con successo");
                    Console.WriteLine("SMS rimanenti: " + result["remaining_sms"]);
    
                    if (result.ContainsKey("id"))
                    {
                        Console.WriteLine("ID: " + result["id"]);
                    }
    
                }
    			
    			// ------------------------------------------------------------------
    			// Controlla la documentazione completa all'indirizzo http://www.skebby.it/business/index/send-docs/ 
    			// ------------------------------------------------------------------
    			// Per i possibili errori si veda http://www.skebby.it/business/index/send-docs/#errorCodesSection
    			// ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    			// ------------------------------------------------------------------			
                if ((string)result["status"] == "failed")
                {
                    Console.WriteLine("Invio fallito");
                    Console.WriteLine("Codice: " + result["code"]);
                    Console.WriteLine("Message: " + result["message"]);
                }
                line = Console.ReadLine();
    
                //// ------------ Controllo del CREDITO RESIDUO -------------
                //credit_result = skebbyGatewayGetCredit("username", "password", "");
    
                //if ((string)credit_result["status"] == "success")
                //{
                //    Console.WriteLine("Credito residuo: " + credit_result["credit_left"]);
                //    Console.WriteLine("SMS Classic rimanenti: " + credit_result["classic_sms"]);
                //    Console.WriteLine("SMS Basic rimanenti: " + credit_result["basic_sms"]);
                //}
    
                //if ((string)credit_result["status"] == "failed")
                //{
                //    Console.WriteLine("Invio richesta fallito");
                //}
                //line = Console.ReadLine();
            }
    
            private static Hashtable skebbyGatewaySendSMS(
                String username, String password,
                String[] recipients, String text,
                String sms_type, String sender_number,
                String sender_string,
                String user_reference,
                String charset)
            {
                String url = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php";
                String result = "";
                String[] results, temp;
                String parameters = "";
                String method = "send_sms_classic";
                int i = 0;
                StreamWriter myWriter = null;
                HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
                objRequest.ServicePoint.Expect100Continue = false;
                
                Hashtable r = new Hashtable();
    
                switch (sms_type)
                {
                    case SMS_TYPE_CLASSIC:
                        method = "send_sms_classic";
                        break;
                    case SMS_TYPE_CLASSIC_PLUS:
                        method = "send_sms_classic_report";
                        break;
                    case SMS_TYPE_BASIC:
                        method = "send_sms_basic";
                        break;
                    case SMS_TYPE_TEST_CLASSIC:
                        method = "test_send_sms_classic";
                        break;
                    case SMS_TYPE_TEST_CLASSIC_PLUS:
                        method = "test_send_sms_classic_report";
                        break;
                    case SMS_TYPE_TEST_BASIC:
                        method = "test_send_sms_basic";
                        break;
                    default:
                        method = "send_sms_classic";
                        break;
                }
    
                parameters = "method=" + HttpUtility.UrlEncode(method) + "&"
                             + "username=" + HttpUtility.UrlEncode(username) + "&password=" + HttpUtility.UrlEncode(password) + "&"
                             + "text=" + HttpUtility.UrlEncode(text) + "&"
                             + "recipients[]=" + string.Join("&recipients[]=", recipients);
    
                if (sender_number != "" && sender_string != "")
                {
                    r.Add("status", "failed");
                    r.Add("code", "0");
                    r.Add("message", "Puoi specificare solo un tipo di mittente, numerico o alfanumerico");
                    return r;
                }
    
                parameters += sender_number != "" ? "&sender_number=" + HttpUtility.UrlEncode(sender_number) : "";
                parameters += sender_string != "" ? "&sender_string=" + HttpUtility.UrlEncode(sender_string) : "";
    
                parameters += user_reference != "" ? "&user_reference=" + HttpUtility.UrlEncode(user_reference) : "";
    
                switch (charset)
                {
                    case "UTF-8":
                        parameters += "&charset=" + HttpUtility.UrlEncode("UTF-8");
                        break;
                    default:
                        break;
                }
    
                objRequest.Method = "POST";
                objRequest.ContentLength = Encoding.UTF8.GetByteCount(parameters);
                objRequest.ContentType = "application/x-www-form-urlencoded";
                HttpWebResponse objResponse;
                try
                {
                    myWriter = new StreamWriter(objRequest.GetRequestStream());
                    myWriter.Write(parameters);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Environment.Exit(1);
                }
                finally
                {
                    myWriter.Close();
                }
                try
                {
                    objResponse = (HttpWebResponse)objRequest.GetResponse();
                }
                catch (WebException e)
                {
                    r.Add("status", "failed");
                    r.Add("code", "0");
                    r.Add("message", "Errore di rete impossibile spedire il messaggio");
                    return r;
                }
                using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
                {
                    result = sr.ReadToEnd();
                    // Close and clean up the StreamReader
                    sr.Close();
                }
                results = result.Split('&');
                for (i = 0; i < results.Length; i++)
                {
                    temp = results[i].Split('=');
                    r.Add(temp[0], temp[1]);
                }
                return r;
            }
    
            private static Hashtable skebbyGatewayGetCredit(
               String username, String password,
               String charset)
            {
                String url = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php";
                String method = "get_credit";
                String result = "";
                String[] results, temp;
                String parameters = "";
                int i = 0;
                StreamWriter myWriter = null;
                HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
                Hashtable r = new Hashtable();
    
                parameters = "method=" + HttpUtility.UrlEncode(method) + "&"
                           + "username=" + HttpUtility.UrlEncode(username) + "&"
                           + "password=" + HttpUtility.UrlEncode(password);
    
                switch (charset)
                {
                    case "UTF-8":
                        parameters += "&charset=" + HttpUtility.UrlEncode("UTF-8");
                        break;
                    default:
                        break;
                }
    
                objRequest.Method = "POST";
                objRequest.ContentLength = Encoding.UTF8.GetByteCount(parameters);
                objRequest.ContentType = "application/x-www-form-urlencoded";
                HttpWebResponse objResponse;
                try
                {
                    myWriter = new StreamWriter(objRequest.GetRequestStream());
                    myWriter.Write(parameters);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Environment.Exit(1);
                }
                finally
                {
                    myWriter.Close();
                }
                try
                {
                    objResponse = (HttpWebResponse)objRequest.GetResponse();
                }
                catch (WebException e)
                {
                    r.Add("status", "failed");
                    r.Add("code", "0");
                    r.Add("message", "Errore di rete impossibile spedire il messaggio");
                    return r;
                }
                using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
                {
                    result = sr.ReadToEnd();
                    // Close and clean up the StreamReader
                    sr.Close();
                }
                results = result.Split('&');
                for (i = 0; i < results.Length; i++)
                {
                    temp = results[i].Split('=');
                    r.Add(temp[0], temp[1]);
                }
                return r;
    
            }
        }
    }					

  • Imports System.Net
    Imports System.IO
    Imports System.Text
    Imports System.Web
    
    Module Module1
    
        Const SMS_TYPE_CLASSIC As String = "classic"
        Const SMS_TYPE_CLASSIC_PLUS As String = "classic_plus"
        Const SMS_TYPE_BASIC As String = "basic"
        Const SMS_TYPE_TEST_CLASSIC As String = "test_classic"
        Const SMS_TYPE_TEST_CLASSIC_PLUS As String = "test_classic_plus"
        Const SMS_TYPE_TEST_BASIC As String = "test_basic"
    
        Private Function skebbyGatewaySendSMS(
                             ByVal username As String, _
                             ByVal password As String, _
                             ByVal recipients() As String, _
                             ByVal text As String, _
                             Optional ByVal sms_type As String = "basic", _
                             Optional ByVal sender_number As String = "", _
                             Optional ByVal sender_string As String = "", _
                             Optional ByVal user_reference As String = "", _
                             Optional ByVal charset As String = "" _
                         ) As Dictionary(Of String, String)
            Dim parameters, method As String
            Dim URL As String
            Dim result As New Dictionary(Of String, String)
            Dim values() As String
            Dim temp
    
            URL = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
    
            method = "send_sms_classic"
    
            Select Case sms_type
                Case SMS_TYPE_CLASSIC
                    method = "send_sms_classic"
                Case SMS_TYPE_CLASSIC_PLUS
                    method = "send_sms_classic_report"
                Case SMS_TYPE_BASIC
                    method = "send_sms_basic"
                Case SMS_TYPE_TEST_CLASSIC
                    method = "test_send_sms_classic"
                Case SMS_TYPE_TEST_CLASSIC_PLUS
                    method = "test_send_sms_classic_report"
                Case SMS_TYPE_TEST_BASIC
                    method = "test_send_sms_basic"
                Case Else
                    method = "send_sms_classic"
            End Select
    
            parameters = "method=" + HttpUtility.UrlEncode(method) + "&" _
                        + "username=" + HttpUtility.UrlEncode(username) + "&" _
                        + "password=" + HttpUtility.UrlEncode(password) + "&" _
                        + "text=" + HttpUtility.UrlEncode(text) + "&" _
                        + "recipients[]=" + String.Join("&recipients[]=", recipients)
    
            If (sender_number <> "") And (sender_string <> "") Then
                result.Add("status", "failed")
                result.Add("code", "0")
                result.Add("message", "Puoi specificare solo un tipo di mittente, numerico o alfanumerico")
                Return result
            End If
    
            If sender_number <> "" Then parameters = parameters + "&sender_number=" + HttpUtility.UrlEncode(sender_number)
            If sender_string <> "" Then parameters = parameters + "&sender_string=" + HttpUtility.UrlEncode(sender_string)
            If user_reference <> "" Then parameters = parameters + "&user_reference=" + HttpUtility.UrlEncode(user_reference)
    
            Select Case charset
                Case "UTF-8"
                    parameters = parameters + "&charset=" + HttpUtility.UrlEncode("UTF-8")
                Case Else
            End Select
    
            ' Create POST
            Dim request As WebRequest = WebRequest.Create(URL)
            request.Method = "POST"
            Dim byteArray As Byte() = Encoding.UTF8.GetBytes(parameters)
            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
            Try
                'Trying to get the response.
                response = request.GetResponse()
            Catch ex As System.Net.WebException
                result.Add("status", "failed")
                result.Add("code", "0")
                result.Add("message", "Errore di rete impossibile spedire il messaggio")
                Return result
            End Try
    
            dataStream = response.GetResponseStream()
            Dim reader As StreamReader = New StreamReader(dataStream)
            Dim responseFromServer As String = reader.ReadToEnd()
            ' Clean up the streams.
            reader.Close()
            dataStream.Close()
            response.Close()
    
            ' Return result to calling function
            If responseFromServer.Length > 0 Then
                values = responseFromServer.Split(New Char() {"&"c})
                For Each value In values
                    temp = value.Split(New Char() {"="c})
                    result.Add(temp(0), temp(1))
                Next
                Return result
            End If
        End Function
    
        Function skebbyGatewayGetCredit(username As String, password As String, Optional charset As String = "") As Dictionary(Of String, String)
            Dim parameters, method As String
            Dim URL As String
            Dim result As New Dictionary(Of String, String)
            Dim values() As String
            Dim temp
    
            URL = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php"
            method = "get_credit"
    
            parameters = "method=" + HttpUtility.UrlEncode(method) + "&" _
                       + "username=" + HttpUtility.UrlEncode(username) + "&" _
                       + "password=" + HttpUtility.UrlEncode(password)
    
            Select Case charset
                Case "UTF-8"
                    parameters = parameters + "&charset=" + HttpUtility.UrlEncode("UTF-8")
                Case Else
            End Select
    
            ' Create POST
            Dim request As WebRequest = WebRequest.Create(URL)
            request.Method = "POST"
            Dim byteArray As Byte() = Encoding.UTF8.GetBytes(parameters)
            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
            Try
                'Trying to get the response.
                response = request.GetResponse()
            Catch ex As System.Net.WebException
                result.Add("status", "failed")
                result.Add("code", "0")
                result.Add("message", "Errore di rete impossibile spedire il messaggio")
                Return result
            End Try
    
            dataStream = response.GetResponseStream()
            Dim reader As StreamReader = New StreamReader(dataStream)
            Dim responseFromServer As String = reader.ReadToEnd()
            ' Clean up the streams.
            reader.Close()
            dataStream.Close()
            response.Close()
    
            ' Return result to calling function
            If responseFromServer.Length > 0 Then
                values = responseFromServer.Split(New Char() {"&"c})
                For Each value In values
                    temp = value.Split(New Char() {"="c})
                    result.Add(temp(0), temp(1))
                Next
                Return result
            End If
    
        End Function
    
        Sub Main()
    
            Dim result
            Dim credit_result
    
            ' Invio singolo
            Dim recipients(0) As String
            recipients(0) = "393471234567"
    
            ' Per invio multiplo
            ' Dim recipients(1) As String
            ' recipients(0) = "393471234567"
            ' recipients(1) = "393477654321"
    
            ' ------------ Invio SMS Classic --------------
    
            ' Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
            result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_CLASSIC, "", "John")
    
            ' Invio SMS CLASSIC con mittente personalizzato di tipo numerico
            ' result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_CLASSIC, "393471234567")
    
    
            ' ------------- Invio SMS Basic ----------------
            ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you? By John", SMS_TYPE_BASIC)
    
    
            ' ------------ Invio SMS Classic Plus -----------
    
            ' Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
            ' result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS, "", "John")
    
            ' Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
            ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"393471234567")
    
            ' Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico e stringa di riferimento personalizzabile
            ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_CLASSIC_PLUS,"393471234567","","riferimento")
    
            ' ------------------------------------------------------------------
            '     ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
            '     SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
            ' ------------------------------------------------------------------
    
    
            ' ------------- Testing invio SMS Classic---------
    
            ' TEST di invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
            ' result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC, "", "John")
    
            ' TEST di invio SMS CLASSIC con mittente personalizzato di tipo numerico
            ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC,"393471234567")
    
    
            ' ------------- Testing invio SMS Classic Plus---------
    
            ' TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
            ' result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC_PLUS, "", "John")
    
            ' TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
            ' result = skebbyGatewaySendSMS("username","password",recipients,"Hi Mike, how are you?", SMS_TYPE_TEST_CLASSIC_PLUS,"393471234567")
    
    
            ' ------------- Testing invio SMS Basic---------------
            ' result = skebbyGatewaySendSMS("username", "password", recipients, "Hi Mike, how are you? By John", SMS_TYPE_TEST_BASIC)
    
    
            If result("status") = "success" Then
                Console.WriteLine("SMS inviato con successo")
                Console.WriteLine("SMS rimanenti: " + result("remaining_sms"))
    
                If (result.ContainsKey("id")) Then
                    Console.WriteLine("ID: " + result("id"))
                End If
            End If
    
    		' ------------------------------------------------------------------
    		' Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    		' ------------------------------------------------------------------
    		' Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    		' ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    		' ------------------------------------------------------------------					
            If result("status") = "failed" Then
                Console.WriteLine("Invio fallito")
                Console.WriteLine("Codice:" + result("code"))
                Console.WriteLine("Motivo:" + result("message"))
            End If
            Console.ReadLine()
    
            ' ------------ Controllo del CREDITO RESIDUO -------------
            'credit_result = skebbyGatewayGetCredit("username", "password")
    
            'If credit_result("status") = "success" Then
            '    Console.WriteLine("Credito residuo: " + credit_result("credit_left"))
            '    Console.WriteLine("SMS Classic rimanenti: " + credit_result("classic_sms"))
            '    Console.WriteLine("SMS Basic rimanenti: " + credit_result("basic_sms"))
            'End If
            'If credit_result("status") = "failed" Then
            '    Console.WriteLine("Invio richiesta fallito")
            'End If
            'Console.ReadLine()
    
        End Sub
    
    End Module					

  • /*
        If you use maven, add the folowing dependency to your pom.xml.
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.1.1</version>
        </dependency>
    
        Otherwise download Apache HttpComponents from http://hc.apache.org/
        and add the libs to your classpath.
    */
    
    
    
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    
    import org.apache.http.HttpEntity;
    import org.apache.http.HttpResponse;
    import org.apache.http.HttpVersion;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.message.BasicNameValuePair;
    import org.apache.http.params.BasicHttpParams;
    import org.apache.http.params.HttpConnectionParams;
    import org.apache.http.params.HttpParams;
    import org.apache.http.params.HttpProtocolParamBean;
    import org.apache.http.util.EntityUtils;
    
    public class HttpPostTest {
    
        public static void main(String[] args) throws Exception {
    //      Invio singolo
    //      String [] recipients = new String[]{"391234567890"};
    //      Invio multiplo
            String [] recipients = new String[]{"391234567890","391234567891"};
    
            String username = "username";
            String password = "password";
    
            // Invio SMS Classic con mittente personalizzato di tipo alfanumerico
            String result = skebbyGatewaySendSMS(username, password, recipients, "Hi Mike, how are you?", "send_sms_classic", null, "John");
            
            // Invio SMS Basic
            // String result = skebbyGatewaySendSMS(username, password, recipients, "Hi Mike, how are you?", "send_sms_basic", null, null);
             
            // Invio SMS Classic con mittente personalizzato di tipo numerico
            // String result = skebbyGatewaySendSMS(username, password, recipients, "Hi Mike, how are you?", "send_sms_classic", "393471234567", null);
             
            // Invio SMS Classic con notifica(report) con mittente personalizzato di tipo alfanumerico - Invio SMS Classic Plus
            // String result = skebbyGatewaySendSMS(username, password, recipients, "Hi Mike, how are you?", "send_sms_classic_report", null, "John");
    
            // Invio SMS Classic con notifica(report) con mittente personalizzato di tipo numerico - Invio SMS Classic Plus
            // String result = skebbyGatewaySendSMS(username, password, recipients, "Hi Mike, how are you?", "send_sms_classic_report", "393471234567", null);
    
    		// ------------------------------------------------------------------
    		// Controlla la documentazione completa all'indirizzo http://www.skebby.it/business/index/send-docs/ 
    		// ------------------------------------------------------------------
    		// Per i possibili errori si veda http://www.skebby.it/business/index/send-docs/#errorCodesSection
    		// ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    		// ------------------------------------------------------------------		
            System.out.println("result: "+result);
        }
        
        protected static String skebbyGatewaySendSMS(String username, String password, String [] recipients, String text, String smsType, String senderNumber, String senderString) throws IOException{
            return skebbyGatewaySendSMS(username, password, recipients, text, smsType,  senderNumber,  senderString, "UTF-8");
        }
        
        protected static String skebbyGatewaySendSMS(String username, String password, String [] recipients, String text, String smsType, String senderNumber, String senderString, String charset) throws IOException{
            
            if (!charset.equals("UTF-8") && !charset.equals("ISO-8859-1")) {
            
                throw new IllegalArgumentException("Charset not supported.");
            }
            
            String endpoint = "http://gateway.skebby.it/api/send/smseasy/advanced/http.php";
            HttpParams params = new BasicHttpParams();
            HttpConnectionParams.setConnectionTimeout(params, 10*1000);
            DefaultHttpClient httpclient = new DefaultHttpClient(params);
            HttpProtocolParamBean paramsBean = new HttpProtocolParamBean(params);
            paramsBean.setVersion(HttpVersion.HTTP_1_1);
            paramsBean.setContentCharset(charset);
            paramsBean.setHttpElementCharset(charset);
            
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            formparams.add(new BasicNameValuePair("method", smsType));
            formparams.add(new BasicNameValuePair("username", username));
            formparams.add(new BasicNameValuePair("password", password));
            if(null != senderNumber)
                formparams.add(new BasicNameValuePair("sender_number", senderNumber));
            if(null != senderString)
                formparams.add(new BasicNameValuePair("sender_string", senderString));
            
            for (String recipient : recipients) {
                formparams.add(new BasicNameValuePair("recipients[]", recipient));
            }
            formparams.add(new BasicNameValuePair("text", text));
            formparams.add(new BasicNameValuePair("charset", charset));
    
        
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, charset);
            HttpPost post = new HttpPost(endpoint);
            post.setEntity(entity);
            
            HttpResponse response = httpclient.execute(post);
            HttpEntity resultEntity = response.getEntity();
            
            return resultEntity == null ? null : EntityUtils.toString(resultEntity);
        }
    }
    					

  • import urllib
    import urllib2
    
    NET_ERROR = "Errore di rete impossibile spedire il messaggio"
    SENDER_ERROR = "Puoi specificare solo un tipo di mittente, numerico o alfanumerico"
    
    def UrlEncode(recipients):
            resultString = ''
            for number in recipients:
                    resultString = resultString + 'recipients[]=' + urllib.quote_plus(number) + '&'
            return resultString[:-1]
    
    def skebbyGatewaySendSMS(username,password,recipients,text,sms_type='basic',sender_number='',sender_string='',charset='ISO-8859-1',options={ 'User-Agent' : 'Generic Client' }):
            url = 'http://gateway.skebby.it/api/send/smseasy/advanced/http.php'
    
            method = 'send_sms_basic'
    
            if sms_type=='classic' : method = 'send_sms_classic'
            if sms_type=='report' : method = 'send_sms_classic_report'
    
            parameters = {
                    'method' : method,
                    'username' : username,
                    'password' : password,
                    'text' : text
            }
    
            if sender_number != '' and sender_string != '' :
                    result = {}
                    result['status'] = 'failed'
                    result['message'] = SENDER_ERROR
                    return result
    
            if sender_number != '' : parameters['sender_number'] = sender_number
            if sender_string != '' : parameters['sender_string'] = sender_string
    
            if charset != 'ISO-8859-1' : parameters['charset'] = 'UTF-8'
    
            headers = options
            data = urllib.urlencode(parameters) + '&' + UrlEncode(recipients)
    
            req = urllib2.Request(url, data, headers)
            try:
                    response = urllib2.urlopen(req)
            except urllib2.HTTPError as e:
                    result = {}
                    result['status'] = 'failed'
                    result['code'] = e.code
                    result['message'] = NET_ERROR
                    return result
            except urllib2.URLError as e:
                    result = {}
                    result['status'] = 'failed'
                    result['message'] = e.reason
                    return result
    
            resultString = response.read()
    
            results = resultString.split('&')
            result = {}
            for r in results:
                    temp = r.split('=')
                    result[temp[0]] = temp[1]
    
            return result
    
    # Invio singolo
    recipients = ["393471234567"]
    
    # Per invio multiplo
    # recipients = ["393331234567","393331234567"]
    
    # Invio SMS Classic con mittente personalizzato di tipo alfanumerico
    result = skebbyGatewaySendSMS('username','password',recipients,'Hi Mike, how are you?','classic','','John')
    
    # Invio SMS Basic
    # result = skebbyGatewaySendSMS('username','password',recipients,'Hi Mike, how are you? By John')
    
    # Invio SMS Classic con mittente personalizzato di tipo numerico
    # result = skebbyGatewaySendSMS('username','password',recipients,'Hi Mike, how are you?','classic','393471234567')
    
    # Invio SMS Classic con notifica(report) con mittente personalizzato di tipo alfanumerico - Invio SMS Classic Plus
    # result = skebbyGatewaySendSMS('username','password',recipients,'Hi Mike, how are you?','report','','John')
    
    # Invio SMS Classic con notifica(report) con mittente personalizzato di tipo numerico - Invio SMS Classic Plus
    # result = skebbyGatewaySendSMS('username','password',recipients,'Hi Mike, how are you?','report','393471234567')
    if(result['status']=='success'):
    		print "SMS inviato con successo\n"
    		print "SMS rimanenti: " + result['remaining_sms']
    
    # ------------------------------------------------------------------
    # Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    # ------------------------------------------------------------------
    # Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    # ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    # ------------------------------------------------------------------
    if(result['status']=='failed'):
    		print "Invio fallito\n"
    		try: print "Codice: " + str(result['code']) + "\n"
    		except KeyError: pass
    		print "Motivo: " + str(result['message']) + "\n"					

  • #!/usr/bin/perl
    
    use LWP::UserAgent;
    use URI::Escape;
    use Switch;
    
    use constant NET_ERROR => "Errore+di+rete+impossibile+spedire+il+messaggio";
    use constant SENDER_ERROR => "Puoi+specificare+solo+un+tipo+di+mittente%2C+numerico+o+alfanumerico";
    
    sub URLEncode {
    	my $theURL = $_[0];
    	$theURL =~ s/([\W])/"%" . uc(sprintf("%2.2x",ord($1)))/eg;
    	return $theURL;
    }
    
    sub URLDecode {
    	my $theURL = $_[0];
    	$theURL =~ tr/+/ /;
    	$theURL =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;
    	$theURL =~ s/<!-(.|\n)*->//g;
    	return $theURL;
    }
    
    sub skebbyGatewaySendSMS {
    
    	my ($username, $password, $recipients, $text, $sms_type, $sender_number, $sender_string, $charset) = @_;
    
    	$ua = new LWP::UserAgent;
    	$req = new HTTP::Request "POST","http://gateway.skebby.it/api/send/smseasy/advanced/http.php";
    	$req->content_type("application/x-www-form-urlencoded");
    
    	$method = "";
    
    	switch($sms_type) {
    		case "classic" { $method="send_sms_classic"; }
    		case "report" { $method="send_sms_classic_report"; }
    		else { $method="send_sms_basic"; }
    	}
    
    	$query = "method=".$method."&username=".URLEncode($username)."&password=".URLEncode($password).$recipients."&text=".URLEncode($text);
    
    	if($sender_number ne "" && $sender_string ne "") {
    		%results = ();
    		$results{"status"} = "failed";
    		$results{"code"} = "0";
    		$results{"message"} = URLDecode(SENDER_ERROR);
    		return %results;
    	}
    
    	$query = $query.($sender_number ne "" ? "&sender_number=".URLEncode($sender_number) : "");
    	$query = $query.($sender_string ne "" ? "&sender_string=".URLEncode($sender_string) : "");
    
    	switch($charset) {
    		case "UTF-8" { $query = $query."&charset=".URLEncode("UTF-8"); }
    		else {}
    	}
    
    	$req->content($query);
    
    	$res = $ua->request($req);
    
    	if ($res->is_error) {
    		%results = ();
    		$results{"status"} = "failed";
    		$results{"code"} = "0";
    		$results{"message"} = URLDecode(NET_ERROR);
    		return %results;
    	}
    
    	%results = ();
    	@result = split("&", $res->content);
    	foreach (@result) {
    		@temp = split("=",$_);
    		$results{$temp[0]} = $temp[1];
    	}
    
    	return %results;
    }
    
    # Invio singolo
    @recipients = ("393471234567");
    
    # Per invio multiplo
    # @recipients = ("393471234567","393337654321");
    
    $recipients = "&recipients[]=".join("&recipients[]=", @recipients);
    
    # Invio SMS Classic con mittente personalizzato di tipo alfanumerico
    %results = skebbyGatewaySendSMS("username","password",$recipients,"Hi Mike, how are you?","classic","","John","");
    
    # Invio SMS Basic
    # %results = skebbyGatewaySendSMS("username","password",$recipients,"Hi Mike, how are you? By John","basic","","","");
    
    # Invio SMS Classic con mittente personalizzato di tipo numerico
    # %results = skebbyGatewaySendSMS("username","password",$recipients,"Hi Mike, how are you?","classic","393471234567","","");
    
    # Invio SMS Classic con notifica(report) con mittente personalizzato di tipo alfanumerico - Invio SMS Classic Plus
    # %results = skebbyGatewaySendSMS("username","password",$recipients,"Hi Mike, how are you?","report","","John","");
    
    # Invio SMS Classic con notifica(report) con mittente personalizzato di tipo numerico - Invio SMS Classic Plus
    # %results = skebbyGatewaySendSMS("username","password",$recipients,"Hi Mike, how are you?","report","393471234567","","");
    
    if ($results{"status"} eq "success") {
    	print "SMS inviato con successo\n";
    	print "SMS rimanenti: ".$results{"remaining_sms"};
    }
    
    # ------------------------------------------------------------------
    # Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    # ------------------------------------------------------------------
    # Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    # ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    # ------------------------------------------------------------------
    if ($results{"status"} eq "failed") {
    	print "Invio fallito\n";
    	print "Codice: ".$results{'code'}."\n";
    	print "Motivo: ".URLDecode($results{'message'})."\n";
    }					

  • # --- Invio SMS Classic --------
    
    # ------------------------------------------------------------------
    # Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    # ------------------------------------------------------------------
    # Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    # ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    # ------------------------------------------------------------------
    
    # Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico (invio singolo)
    curl --data "method=send_sms_classic&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_string=John" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico (invio multiplo)
    curl --data "method=send_sms_classic&username=username&password=password&recipients[]=393471234567&recipients[]=393477654321&text=Hi+Mike%2C+how+are+you%3F&sender_string=John" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # Invio SMS CLASSIC con mittente personalizzato di tipo numerico
    curl --data "method=send_sms_classic&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_number=393471234567" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # --- Invio SMS Basic -----------
    curl --data "method=send_sms_basic&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # --- Invio SMS Classic Plus ----
    
    # Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
    curl --data "method=send_sms_classic_report&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_string=John" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    curl --data "method=send_sms_classic_report&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_number=393471234567" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico e stringa di riferimento personalizzabile
    curl --data "method=send_sms_classic_report&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_number=393471234567&user_reference=riferimento" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # ------------------------------------------------------------------
    #	ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
    #   SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
    # ------------------------------------------------------------------
    
    # --- Testing invio SMS Classic -------
    # TEST di invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
    curl --data "method=test_send_sms_classic&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_string=John" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # TEST di invio SMS CLASSIC con mittente personalizzato di tipo numerico
    curl --data "method=test_send_sms_classic&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_number=393471234567" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # --- Testing invio SMS Classic Plus ---
    
    # TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
    curl --data "method=test_send_sms_classic_report&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_string=John" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    curl --data "method=test_send_sms_classic_report&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you%3F&sender_number=393471234567" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # --- Testing invio SMS Basic ----------
    curl --data "method=test_send_sms_basic&username=username&password=password&recipients[]=393471234567&text=Hi+Mike%2C+how+are+you" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    
    # --- Controllo del CREDITO RESIDUO ----
    curl --data "method=get_credit&username=username&password=password" http://gateway.skebby.it/api/send/smseasy/advanced/http.php
    					

  • var qs = require('querystring');
    var https = require('https');
    
    var send_sms_skebby = function(input,cb,cb_err){
        var text = input.text;
        var sender_number = input.sender_number || "";
        var sender_string = input.sender_string || "";
    	var method = input.method;
        var lrecipients = input.recipients || [];
        var username = input.username;
        var password = input.password;
        
    	if(!method){
    		cb_err("Nessun metodo!");
    		return;
        }
    
    	switch(method) {
            case 'classic':
                method='send_sms_classic';
                break;
            case 'report':
                method='send_sms_classic_report';
                break;
            case 'basic':
            default:
                method='send_sms_basic';
        }
        
    	var test = input.test || false;
        
        // Check params
        if(lrecipients.length == 0){
    		cb_err("Nessun destinatario!");
    		return;
        }
    
        if(!sender_string && !sender_number){
    		cb_err("Nessun mittente!");
    		return;
        }
    
        if(!text){
    		cb_err("Nessun testo!");
    		return;
        }    
        
        var params = {
    		method : method,
    		username : username,
    		password : password,
    		"recipients[]" : lrecipients,
    		text : text,
    		charset : "UTF-8",
        };
    
        if(sender_number){
    		params.sender_number = sender_number;
        }
        else if(sender_string){
    		params.sender_string = sender_string;
        }
    
        if(test){
    		params.method = "test_"+params.method;
        }
        
        var res_done = false;
        var data = qs.stringify(params);
    
        var client = https.request({
        	port : 443,
        	path : "/api/send/smseasy/advanced/http.php",
        	host: "gateway.skebby.it",
        	method : "POST", 
        	headers: { 
        	    "Content-Type" : "application/x-www-form-urlencoded",
        	    "Content-Length": data.length,
        	    "Content-Encoding" : "utf8",
        	}
        },function(res){
        	var res_data = "";
        	res.on('data', function(data) {
        	    res_data+=data;
        	});
        	res.on("end",function(){
        	    if (!res_done){
    		var res_parsed = qs.parse(res_data);
    		if(res_parsed.status == "success"){
    		    cb({data:res_parsed});
    		}
    		else{
    			// ------------------------------------------------------------------
    			// Controlla la documentazione completa all'indirizzo http://www.skebby.it/business/index/send-docs/ 
    			// ------------------------------------------------------------------
    			// Per i possibili errori si veda http://www.skebby.it/business/index/send-docs/#errorCodesSection
    			// ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    			// ------------------------------------------------------------------		
    		    cb_err(res_parsed);
    		}
        		res_done = true;
        	    }
        	});
        });	
    
        client.end(data);
        client.on('error', function(e) {
        	if (!res_done){
        	    cb_err(e);
        	    res_done = true;
        	}
        });
    };
    
    // Invio SMS Classic con mittente personalizzato di tipo alfanumerico
    send_sms_skebby( {
    	method : "classic",
    	username : "username",
    	password : "password", 
        recipients : ["393396803445"],
        //recipients : ["393396803445","393395352490"],
        text : "Hi Mike, how are you?2",
    },function(res){
        console.log(res.data);
    },function(err){
        console.log(err);
    });
    
    /*
    // Invio SMS Basic
    send_sms_skebby( {
    	method : "basic",
    	username : "username",
    	password : "password", 
        recipients : ["393396803445"],
        //recipients : ["393396803445","393395352490"],
        text : "Hi Mike, how are you? By John",
    },function(res){
        console.log(res.data);
    },function(err){
        console.log(err);
    });
    
    // Invio SMS Classic con mittente personalizzato di tipo numerico
    send_sms_skebby( {
    	method : "classic",
    	username : "username",
    	password : "password",
        sender_number : "393471234567",
        recipients : ["393396803445"],
        //recipients : ["393396803445","393395352490"],
        text : "Hi Mike, how are you?",
    },function(res){
        console.log(res.data);
    },function(err){
        console.log(err);
    });
    
    // Invio SMS Classic con mittente personalizzato di tipo alfanumerico
    send_sms_skebby( {
    	method : "report",
    	username : "username",
    	password : "password",
        sender_string : "John",   
        recipients : ["393396803445"],
        //recipients : ["393396803445","393395352490"],
        text : "Hi Mike, how are you?",
    },function(res){
        console.log(res.data);
    },function(err){
        console.log(err);
    });
    
    // Invio SMS Classic con mittente personalizzato di tipo numerico
    send_sms_skebby( {
    	method : "report",
    	username : "username",
    	password : "password",
        sender_number : "393471234567",  
        recipients : ["393396803445"],
        //recipients : ["393396803445","393395352490"],
        text : "Hi Mike, how are you?",
    },function(res){
        console.log(res.data);
    },function(err){
        console.log(err);
    });
    */					

  • require 'net/http'
    require 'uri'
    require 'cgi'
    
    class SkebbyGatewaySendSMS
      
    	def initialize(username = '', password = '')
    		@url = 'http://gateway.skebby.it/api/send/smseasy/advanced/http.php'
    
    		@parameters = {
    			'username'		=> username,
    			'password'		=> password,
    		}
    	end
    
    	def sendSMS(method, text, recipients, options = {})
    	  unless recipients.kind_of?(Array)
    	    raise("recipients must be an array")
    	  end
    	
    	  @parameters['method'] = method
    	  @parameters['text'] = text
    	  
    	  @parameters["recipients[]"] = recipients
      
        unless options[:senderNumber].nil?
         @parameters['sender_number'] = options[:senderNumber]
        end
    
        unless options[:senderString].nil?
         @parameters['sender_string'] = options[:senderString]
        end
    
        unless options[:charset].nil?
         @parameters['charset'] = options[:charset]
        end
            
        @parameters.each {|key, value| puts "#{key} is #{value}" }    
            
    		@response = Net::HTTP.post_form(URI(@url), @parameters)
    		if @response.message == "OK"
    			true
    		else
    			false
    		end
    		
    	end
    	
    	def getCredit()
    	  
        @parameters['method']	= 'get_credit'
        
    		@response = Net::HTTP.post_form(URI(@url), @parameters)
    		if @response.message == "OK"
    			true
    		else
    			false
    		end
    	end
    	
    	def getResponse
    		result = {}
    		@response.body.split('&').each do |res|
    			if res != ''
    				temp = res.split('=')
    				if temp.size > 1
    					result[temp[0]] = temp[1]
    				end
    			end
    		end
    		return result
    	end
    
    	def printResponse
    		result = self.getResponse
    		if result.has_key?('status') and result['status'] == 'success'
    			puts "Success, response contains:"
    			result.each do |key,value|
    				puts "\t#{key} => #{CGI::unescape(value)}"
    			end
    			true
    		else
    			# ------------------------------------------------------------------
    			# Controlla la documentazione completa all'indirizzo http:#www.skebby.it/business/index/send-docs/ 
    			# ------------------------------------------------------------------
    			# Per i possibili errori si veda http:#www.skebby.it/business/index/send-docs/#errorCodesSection
    			# ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    			# ------------------------------------------------------------------		
    			puts "Error, trace is:"
    			result.each do |key,value|
    				puts "\t#{key} => #{CGI::unescape(value)}"
    			end
    			false
    		end
    	end
    
    end
    
    gw = SkebbyGatewaySendSMS.new('username', 'password')
    
    #Invio singolo
    recipients = ["393471234567"]
    
    #Invio multiplo
    #recipients = ["393471234567","393497654321"]
    
    #Invio SMS Classic con mittente personalizzato di tipo alfanumerico
    result = gw.sendSMS('send_sms_classic', 'Hi Mike, how are you', recipients, { :senderString => 'Jhon' } )
    
    #Invio SMS Basic
    #result = gw.sendSMS('send_sms_basic', 'Hi Mike, how are you? By John', recipients )
    
    #Invio SMS Classic con mittente personalizzato di tipo numerico
    #result = gw.sendSMS('send_sms_classic', 'Hi Mike, how are you', recipients, { :senderNumber => '393471234567' } )
    
    #Invio SMS Classic con notifica(report) con mittente personalizzato di tipo alfanumerico - Invio SMS Classic Plus
    #result = gw.sendSMS('send_sms_classic_report', 'Hi Mike, how are you', recipients, { :senderString => 'Jhon' } )
    
    #Invio SMS Classic con notifica(report) con mittente personalizzato di tipo numerico - Invio SMS Classic Plus
    #result = gw.sendSMS('send_sms_classic_report', 'Hi Mike, how are you', recipients, { :senderNumber => '393471234567' } )
    
    #Richiesta credito
    #result = gw.getCredit()
    
    if result
    	gw.printResponse
    else
      puts "Error in the HTTP request"
    end					

  • /*
    SKEBBYGATEWAYAPI C++ EXAMPLE
    TOTI PIERANDREA
    SKEBBY
    MOBILE SOLUTIONS S.R.L.
    
    WARNING: THIS EXAMPLE USES CROSSPLATFORM LIBRARY "LIBCURL": YOU CAN DOWNLOAD IT AT http://curl.haxx.se/
    */
    
    #include <iostream>
    #include <string>
    #include <vector>
    #include "curl\curl.h"
    
    using namespace std;
    
    #define SMS_TYPE_CLASSIC 0
    #define SMS_TYPE_CLASSIC_PLUS  1
    #define SMS_TYPE_BASIC   2
    #define SMS_TYPE_TEST_CLASSIC  3
    #define SMS_TYPE_TEST_CLASSIC_PLUS  4
    #define SMS_TYPE_TEST_BASIC  5
    
    #define utf8(str)  ConvertToUTF8(L##str)
    
    #ifdef _WIN32
    
    const string ConvertToUTF8(const wchar_t * pStr)
    {
    	static char szBuf[1024];
    	WideCharToMultiByte(CP_UTF8, 0, pStr, -1, szBuf, sizeof(szBuf), NULL, NULL);
    	string ret(szBuf);
    	return ret;
    }
    
    #else
    
    const string ConvertToUTF8(const wstring& src)
    {
    	string ret = "";
    	for (size_t i = 0; i < src.size(); i++){
    		wchar_t w = src[i];
    		if (w <= 0x7f)
    			ret.push_back((char)w);
    		else if (w <= 0x7ff)
    		{
    			ret.push_back(0xc0 | ((w >> 6)& 0x1f));
    			ret.push_back(0x80| (w & 0x3f));
    		}
    		else if (w <= 0xffff)
    		{
    			ret.push_back(0xe0 | ((w >> 12)& 0x0f));
    			ret.push_back(0x80| ((w >> 6) & 0x3f));
    			ret.push_back(0x80| (w & 0x3f));
    		}
    		else if (w <= 0x10ffff)
    		{
    			ret.push_back(0xf0 | ((w >> 18)& 0x07));
    			ret.push_back(0x80| ((w >> 12) & 0x3f));
    			ret.push_back(0x80| ((w >> 6) & 0x3f));
    			ret.push_back(0x80| (w & 0x3f));
    		}
    		else
    			ret.push_back('?');
    	}
    	return ret;
    }
    
    #endif
    
    size_t write_to_string(void *ptr, size_t size, size_t count, void *stream)
    {
    	((string*)stream)->append((char*)ptr, 0, size*count);
    	return size*count;
    }
    
    static string skebbyGatewaySendSMS(const string &username, const string &password,
    	vector<string> &recipients,const string &text,const string &sms_type,
    	const string &sender_number, const string &sender_string, const string &user_reference)
    {
    	CURL *curl;
    	CURLcode res;
    
    	struct curl_httppost *formpost=NULL;
    	struct curl_httppost *lastptr=NULL;
    	struct curl_slist *headerlist=NULL;
    	static const char buf[] = "Expect:";
    
    	curl_global_init(CURL_GLOBAL_ALL);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "method",
    		CURLFORM_COPYCONTENTS, &sms_type[0],
    		CURLFORM_END);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "username",
    		CURLFORM_COPYCONTENTS, &username[0],
    		CURLFORM_END);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "password",
    		CURLFORM_COPYCONTENTS, &password[0],
    		CURLFORM_END);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "charset",
    		CURLFORM_COPYCONTENTS, "UTF-8",
    		CURLFORM_END);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "text",
    		CURLFORM_COPYCONTENTS, &text[0],
    		CURLFORM_END);
    
    	for (vector<string>::iterator i = recipients.begin();i != recipients.end();++i)
    	{
    		curl_formadd(&formpost,
    			&lastptr,
    			CURLFORM_COPYNAME, "recipients[]",
    			CURLFORM_COPYCONTENTS, &(*i)[0],
    			CURLFORM_END);
    	}
    
    	if(sender_number.length() > 0 )
    	{
    		curl_formadd(&formpost,
    			&lastptr,
    			CURLFORM_COPYNAME, "sender_number",
    			CURLFORM_COPYCONTENTS, &sender_number[0],
    			CURLFORM_END);
    	}
    
    	if(sender_string.length() > 0 )
    	{
    		curl_formadd(&formpost,
    			&lastptr,
    			CURLFORM_COPYNAME, "sender_string",
    			CURLFORM_COPYCONTENTS, &sender_string[0],
    			CURLFORM_END);
    	}
    
    	if(user_reference.length() > 0 )
    	{
    		curl_formadd(&formpost,
    			&lastptr,
    			CURLFORM_COPYNAME, "user_reference",
    			CURLFORM_COPYCONTENTS, &user_reference[0],
    			CURLFORM_END);
    	}
    
    
    	headerlist = curl_slist_append(headerlist, buf);
    	curl = curl_easy_init();
    
    	if(curl)
    	{
    
    		string response;
    		curl_easy_setopt(curl, CURLOPT_URL, "http://gateway.skebby.it/api/send/smseasy/advanced/http.php");
    		curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
    		curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
    		curl_easy_setopt(curl, CURLOPT_TIMEOUT, 100);
    		curl_easy_setopt(curl, CURLOPT_ENCODING, "UTF-8" );
    		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_to_string);
    		curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
    		res = curl_easy_perform(curl);
    
    		// always cleanup
    		curl_easy_cleanup(curl);
    		curl_formfree(formpost);
    		curl_slist_free_all (headerlist);
    
    		if(res == CURLE_OK )
    			return response;
    	}
    	return "Error Occured";
    }
    
    
    static string skebbyGatewayGetCredit(const string &username,const string &password)
    {
    	CURL *curl;
    	CURLcode res;
    
    	struct curl_httppost *formpost=NULL;
    	struct curl_httppost *lastptr=NULL;
    
    	curl_global_init(CURL_GLOBAL_ALL);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "method",
    		CURLFORM_COPYCONTENTS, "get_credit",
    		CURLFORM_END);
    
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "username",
    		CURLFORM_COPYCONTENTS, &username[0],
    		CURLFORM_END);
    
    	curl_formadd(&formpost,
    		&lastptr,
    		CURLFORM_COPYNAME, "password",
    		CURLFORM_COPYCONTENTS, &password[0],
    		CURLFORM_END);
    
    	curl = curl_easy_init();
    
    	if(curl)
    	{
    		string response;
    		curl_easy_setopt(curl, CURLOPT_URL, "http://gateway.skebby.it/api/send/smseasy/advanced/http.php");
    		curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
    		curl_easy_setopt(curl, CURLOPT_TIMEOUT, 100);
    		curl_easy_setopt(curl, CURLOPT_ENCODING, "UTF-8" );
    		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_to_string);
    		curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
    		res = curl_easy_perform(curl);
    		curl_easy_cleanup(curl);
    		curl_formfree(formpost);
    
    		if(res == CURLE_OK )
    			return response;
    	}
    
    	return "Error Occured";
    }
    
    int main()
    {
    
    	string username = utf8("username");
    	string password = utf8("password");
    	vector<string> recipients;
    
    	// Invio singolo
    	recipients.push_back("393471234567");	
    	
    	// Per invio multiplo
    	// recipients.push_back("393471234567");
    	// recipients.push_back("393477654321");
    
    	string smstype[6] = {"send_sms_classic","send_sms_classic_report","send_sms_basic","test_send_sms_classic","test_send_sms_classic_report","test_send_sms_basic"} ;
    	string message = utf8("Hi Mike, how are you?");
    	string result;
    
    	// ------------------------------------------------------------------
    	// Controlla la documentazione completa all'indirizzo http://www.skebby.it/business/index/send-docs/ 
    	// ------------------------------------------------------------------
    	// Per i possibili errori si veda http://www.skebby.it/business/index/send-docs/#errorCodesSection
    	// ATTENZIONE: in caso di errore Non si deve riprovare l'invio, trattandosi di errori bloccanti
    	// ------------------------------------------------------------------	
    	
    	// ------------ Invio SMS Classic --------------
    
    	// Invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
    	 result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_CLASSIC], "393471234567", "John", "");
    
    	// Invio SMS CLASSIC con mittente personalizzato di tipo numerico
        // result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_CLASSIC], "393471234567", "", "");
    
    	// ------------- Invio SMS Basic ----------------
        // result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_BASIC], "", "", "");
    
    	// ------------ Invio SMS Classic Plus -----------
    
        // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
        // result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_CLASSIC_PLUS], "", "John", "");
    
        // Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
    	// result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_CLASSIC_PLUS], "393471234567", "", "");
    
    	// Invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico e stringa di riferimento personalizzabile
    	// result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_CLASSIC_PLUS], "393471234567", "", "riferimento");
    
    
        // ------------------------------------------------------------------
        // ATTENZIONE I TIPI DI SMS SMS_TYPE_TEST* NON FANNO PARTIRE ALCUN SMS 
        // SERVONO SOLO PER VERIFICARE LA POSSIBILITA' DI RAGGIUNGERE IL SERVER DI SKEBBY 
        // ------------------------------------------------------------------
    
        // ------------- Testing invio SMS Classic---------
    
        // TEST di invio SMS CLASSIC con mittente personalizzato di tipo alfanumerico
    	// result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_TEST_CLASSIC], "", "John", "");
    
        // TEST di invio SMS CLASSIC con mittente personalizzato di tipo numerico
    	// result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_TEST_CLASSIC], "393471234567", "", "");
    
    
        // ------------- Testing invio SMS Classic Plus---------
    
        // TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo alfanumerico
        // result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_TEST_CLASSIC_PLUS], "", "John", "");
    
        // TEST di invio SMS CLASSIC PLUS(con notifica) con mittente personalizzato di tipo numerico
        // result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_TEST_CLASSIC_PLUS], "393471234567", "", "");
    
    	
        // ------------- Testing invio SMS Basic---------------
        // result = skebbyGatewaySendSMS(username, password, recipients, message, smstype[SMS_TYPE_TEST_BASIC], "", "", "");
    
    	// ------------ Controllo del CREDITO RESIDUO -------------
    	// result = skebbyGatewayGetCredit(username,password);
    
    	cout << result << endl;
    	return 0;
    }					

  • // PROGETTO DI ESEMPIO PER RAD STUDIO DISPONIBILE QUI:
    // http://static.skebby.it/s/apps/gateway/send/skebby-gw-radstudio-delphi-example.zip
    {==============================================================================|
    | Project : Skebby Gateway SMS                                                 |
    |==============================================================================|
    | Content: Esempio Gateway in Delphi                                           |
    |==============================================================================|
    | L'esempio e' stato testato su Embarcadero RAD Studio XE5                     |
    | Suppone la creazione di un Form TFormEsempio con un bottone SkebbySendSMS    |
    | e l'integrazione delle librerie Delphi Synapse:                              |
    | URL: http://www.ararat.cz/synapse/ prendere l'ultima versione da SVN		   | 	
    |==============================================================================}
    
    unit Skebby;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, blcksock, synacode, httpsend;
    
    type
      TFormEsempio = class(TForm)
        SkebbySendSMS: TButton;
        procedure SkebbySendSMSClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      FormEsempio: TFormEsempio;
    
    
    type TSkebbySMSType = (smsTestClassic, smsBasic, smsClassic, smsClassicPlus);// 0=Test Classic, 1=Basic, 2=Classic, 3=Classic Plus
    
    type TSkebbyResponse = record
      status: string;
      code: string;
      msg: string;
      remainingSMS: string;
      credit: Double;
      sms_basic_left: integer;
      sms_classic_left: integer;
    end;
    
    type TSkebbyGateway = class
      private
        FURLGateway: string;
        FUsername: string;
        FPassword: string;
        FTipoSMS: integer;
        FNumeroMittente: string;
        FNomeMittente: string;
        FRecipients: TStringList;
        FMessaggio: string;
    
        FParams: string;
    
        procedure PrepareSMSParams(smsType: TSkebbySMSType);
        procedure PrepareCreditParams;
    
        function ParseSMSResponse(resp: string): TSkebbyResponse;
        function ParseCreditResponse(resp: string): TSkebbyResponse;
      public
    
        constructor Create;
        destructor Destroy; override;
    
        procedure AddDestinatario(numero: string);
        procedure SetSMSText(testo: string);
    
        function TestServizio: TSkebbyResponse;
        function GetCredito: TSkebbyResponse;
        function SendSMS(tipo: TSkebbySMSType): TSkebbyResponse;
    end;
    
    const
      TEST_SMS_CLASSIC = 'test_send_sms_classic';
      TEST_SMS_BASIC = 'test_send_sms_basic';
    
      SMS_BASIC = 'send_sms_basic';
      SMS_CLASSIC = 'send_sms_classic';
      SMS_CLASSIC_PLUS = 'send_sms_classic_report';
    
      SMS_SUCCESS = 'success';
      SMS_FAILED = 'failed';
    
    implementation
    {$R *.dfm}
    
    
    { TSkebbyGateway }
    
    procedure TSkebbyGateway.AddDestinatario(numero: string);
    begin
      FRecipients.Add(numero);
      inherited;
    end;
    
    constructor TSkebbyGateway.Create;
    begin
      FRecipients := TStringList.Create;
    
    // VARIABILI DI CONFIGURAZIONE
    // INSERIRE PROPRIE CREDENZIALI ED IMPOSTAZIONI SMS QUI
      FMessaggio := '';
      FURLGateway := 'http://gateway.skebby.it/api/send/smseasy/advanced/http.php';
      FUsername := 'username';
      FPassword := 'password';
      FTipoSMS := 2;
      FNumeroMittente := '';
      FNomeMittente := 'John';
    end;
    
    destructor TSkebbyGateway.Destroy;
    begin
      FRecipients.Free;
    end;
    
    
    function TSkebbyGateway.GetCredito: TSkebbyResponse;
    var
      chk: Boolean;
      stm: TStringStream;
    begin
      stm := TStringStream.Create('');
    
      PrepareCreditParams;
    
      try
        chk := HttpPostURL(FURLGateway, FParams, stm);
        if chk then
        begin
          Result := ParseCreditResponse(stm.DataString);
        end
        else
        begin
          Result.status := SMS_FAILED;
          Result.msg := 'Errore durante il collegamento con il server SMS!';
        end;
      finally
        stm.Free;
      end;
    end;
    
    function TSkebbyGateway.ParseSMSResponse(resp: string): TSkebbyResponse;
    var
      list: TStringList;
    begin
      list := TStringList.Create;
      try
        list.Text := StringReplace(resp, '&', #13#10, [rfReplaceAll]);
        Result.status := list.Values['status'];
        if Result.status = SMS_SUCCESS then
        begin
          Result.msg := 'Invio SMS effettuato con successo';
          Result.remainingSMS := list.Values['remaining_sms'];
        end;
    
        if Result.status = SMS_FAILED then
        begin
          Result.code := list.Values['code'];
          Result.msg := list.Values['message'];
        end;
      finally
        list.Free;
      end;
    end;
    
    function TSkebbyGateway.ParseCreditResponse(resp: string): TSkebbyResponse;
    var
      list: TStringList;
    begin
      list := TStringList.Create;
      try
        list.Text := StringReplace(resp, '&', #13#10, [rfReplaceAll]);
        Result.status := list.Values['status'];
        if Result.status = SMS_SUCCESS then
        begin
          Result.credit := StrToFloatDef(list.Values['credit_left'], 0.0);
          Result.sms_basic_left := StrToIntDef(list.Values['basic_sms'], 0);
          Result.sms_classic_left := StrToIntDef(list.Values['classic_sms'], 0);
        end;
    
        if Result.status = SMS_FAILED then
        begin
          Result.code := '';
          Result.msg := 'Invio richiesta fallito!';
        end;
      finally
        list.Free;
      end;
    end;
    
    procedure TSkebbyGateway.PrepareCreditParams;
    var
      urlParams: string;
    begin
      FParams := '';
    
      urlParams := '';
      urlParams := urlParams + 'method=get_credit&';
      urlParams := urlParams + 'username=' + EncodeURLElement(FUsername) + '&';
      urlParams := urlParams + 'password=' + EncodeURLElement(FPassword) + '&';
    
      FParams := urlParams;
    end;
    
    procedure TSkebbyGateway.PrepareSMSParams(smsType: TSkebbySMSType);
    var
      k: Integer;
      urlParams: string;
    begin
      FParams := '';
    
      urlParams := '';
    
      case smsType of
        smsTestClassic:
          urlParams := urlParams + 'method=' + EncodeURLElement(TEST_SMS_CLASSIC) + '&';
        smsBasic:
          urlParams := urlParams + 'method=' + EncodeURLElement(SMS_BASIC) + '&';
        smsClassic:
          urlParams := urlParams + 'method=' + EncodeURLElement(SMS_CLASSIC) + '&';
        smsClassicPlus:
          urlParams := urlParams + 'method=' + EncodeURLElement(SMS_CLASSIC_PLUS) + '&';
      else // default usa il metodo TEST
        urlParams := urlParams + 'method=' + EncodeURLElement(TEST_SMS_CLASSIC) + '&';
      end;
    
      urlParams := urlParams + 'username=' + EncodeURLElement(FUsername) + '&';
      urlParams := urlParams + 'password=' + EncodeURLElement(FPassword) + '&';
      urlParams := urlParams + 'text=' + EncodeURLElement(FMessaggio) + '&';
    
      for k:=0 to FRecipients.Count - 1 do
      begin
        urlParams := urlParams + 'recipients[]=' + EncodeURLElement(FRecipients[k]) + '&';
      end;
    
      if FNumeroMittente <> '' then
        urlParams := urlParams + 'sender_number=' + EncodeURLElement(FNumeroMittente) + '&';
      if FNomeMittente <> '' then
        urlParams := urlParams + 'sender_string=' + EncodeURLElement(FNomeMittente) + '&';
    
    
      FParams := urlParams;
    end;
    
    procedure TSkebbyGateway.SetSMSText(testo: string);
    begin
      FMessaggio := testo;
    end;
    
    function TSkebbyGateway.TestServizio: TSkebbyResponse;
    begin
      Result := SendSMS(smsTestClassic);
    end;
    
    function TSkebbyGateway.SendSMS(tipo: TSkebbySMSType): TSkebbyResponse;
    var
      chk: Boolean;
      stm: TStringStream;
    begin
      PrepareSMSParams(tipo);
    
      stm := TStringStream.Create('');
      try
        chk := HttpPostURL(FURLGateway, FParams, stm);
        if chk then
        begin
          Result := ParseSMSResponse(stm.DataString);
        end
        else
        begin
          Result.status := SMS_FAILED;
          Result.msg := 'Errore durante il collegamento con il server SMS!';
        end;
      finally
        stm.Free;
      end;
    end;
    
    
    
    procedure TFormEsempio.SkebbySendSMSClick(Sender: TObject);
    var
      sms: TSkebbyGateway;
      resp: TSkebbyResponse;
    begin
      sms := TSkebbyGateway.Create;
      try
      	// Destinatari:
        sms.AddDestinatario('393491234567');
        // sms.AddDestinatario('393331234567');
        // Testo:
        sms.SetSMSText('Hi Mike, how are you?');
        // Tipo Messaggio:
        // smsBasic   		= send_sms_basic
        // smsClassic 		= send_sms_classic
        // smsClassicPlus	= send_sms_report
        // testSmsClassic	= test_send_sms_classic
        resp := sms.SendSMS(smsClassic);
        if resp.status = SMS_SUCCESS then
        begin
          // resp.remainingSMS contiene il numero di SMS rimanenti
          ShowMessage('SMS inviato con successo');
        end
        else
        begin
          // resp.msg contiene il codice di errore
          ShowMessage('Invio fallito');
        end;
      finally
        sms.free;
      end;
    end;
    
    end.					

Esempi Ricezione SMS

Di seguito trovi una selezione di esempi che puoi copiare e modificare a piacere. Se necessiti di aiuto contattaci
Copy to clipboard


  • <?php
    	$sender = $_POST['sender'];
    	$receiver = $_POST['receiver'];
    	$text = $_POST['text'];
    	$encoding = $_POST['encoding'];
    	$date = $_POST['date'];
    	$time = $_POST['time'];
    	$timestamp = $_POST['timestamp'];
    	$smsType = $_POST['smsType'];
    	
    	// i dati DEVONO essere salvati in un file o in un database per essere memorizzati e gestiti
    	
    ?>
    /*
    sender		Numero del mittente dell'SMS in forma internazionale senza + o 00, ad esempio: 393334455666
    receiver	Il numero su cui e' arrivato l'SMS in forma internazionale senza + o 00, ad esempio: 393334455666
    text		Testo dell'SMS
    encoding	Il set di caratteri usati per il testo (ISO-8859-1)
    date		La data di arrivo dell'SMS
    time		L'orario di arrivo dell'SMS
    timestamp	Il timestamp di arrivo dell'SMS per comodita' del programmatore passiamo tre formati differenti di data / ora
    smsType		Il tipo di SMS ricevuto (standard o skebby)
    */					

  • <%
    	sender = Request.Form("sender")
    	receiver = Request.Form("receiver")
    	text = Request.Form("text")
    	encoding = Request.Form("encoding")
    	date = Request.Form("date")
    	time = Request.Form("time")
    	timestamp = Request.Form("timestamp")
    	smsType = Request.Form("smsType")
    	
    	' i dati DEVONO essere salvati in un file o in un database per essere memorizzati e gestiti
    
    %>
    '
    ' sender		Numero del mittente dell'SMS in forma internazionale senza + o 00, ad esempio: 393334455666
    ' receiver	Il numero su cui e' arrivato l'SMS in forma internazionale senza + o 00, ad esempio: 393334455666
    ' text		Testo dell'SMS
    ' encoding	Il set di caratteri usati per il testo (ISO-8859-1)
    ' date		La data di arrivo dell'SMS
    ' time		L'orario di arrivo dell'SMS
    ' timestamp	Il timestamp di arrivo dell'SMS per comodita' del programmatore passiamo tre formati differenti di data / ora
    ' smsType		Il tipo di SMS ricevuto (standard o skebby)
    '					

Potrebbe esserti utile leggere la nostra documentazione integrale per capire come usare queste API