Home/Servizi/SMS/Sviluppatori
Integrazione facile con SDK e API SMS di Vola
Grazie agli SDK e alle API SMS di Vola puoi integrare facilmente e senza costi aggiuntivi i nostri servizi SMS nel tuo sito o all’interno dei tuoi software.
E’ possibile accedere al Gateway di Vola attraverso una delle seguenti soluzioni:
SMS Gateway API
SDK for Development
Documentazione SMS Gateway API
VolaSMS PLUS HTTPS Protocol 3.0 offre la possibilità di accedere alle principali funzionalità del Gateway Vola attraverso il protocollo HTTPS.
Di seguito le principali caratteristiche:
- Funzionalità ottimizzata per invio di più messaggi all’interno della stessa richiesta
- Autenticazione di un numero di cellulare come mittente
- Invio all’estero
- Richiesta degli stati di avvenuta ricezione
Scarica la documentazione relativa al protocollo HTTPS Gateway VolaSMS Plus
DownloadSDK for Development
E’ una suite di sviluppo completamente gratuita per creare applicazioni che richiedono l’invio o la ricezione di SMS.
Di seguito le principali caratteristiche:
- Invio ottimizzato di SMS-MT (Mobile Terminated) in Italia e verso Paesi Esteri
- Possibilità di ricevere SMS-MO (Mobile Originated)
- Possibilità di richiedere lo stato di notifica di avvenuta consegna degli SMS sul cellulare del destinatario
La famiglia di tools di sviluppo Vola SDK comprende un insieme di classi .NET (da includere nelle proprie applicazioni .NET) e una classe Java (per l’utilizzo su piattaforme Mac, Linux, Unix in generale e Windows).
Fai il download gratuito dei tools che Vola mette a disposizione!
Scarica i tools di sviluppo Vola SDK

Insieme di classi con relativo codice sorgente da includere nelle proprie applicazioni .NET per includere le funzionalità di invio e ricezione di messaggi SMS attraverso il Gateway Vola. Il codice sorgente delle classi C# e VB è rilasciato sotto licenza LGPL. Download
Manuale programmatore per VolaSMS Plus.Net Classes Download

Libreria per progetti realizzati su qualsiasi piattaforma con run-time Java (Mac, Linux, Unix e Windows) da includere nelle proprie applicazioni per includere le funzionalità di invio e ricezione di messaggi SMS attraverso il Gateway Vola. Implementa tutti i metodi esposti da VolaSMS PLUS HTTP Protocol 3.0. Download
Esempi di codice PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
<?php # # Esempio di richiesta credito residuo SMS # $res=getCredit("xxxxx", "yyyyy", "TR45GDLBO730HDUIEQJ5"); print_r($res); exit; # # Funzione che effettua la richiesta del credito. # Viene restituito un array associativo: # 'CODE_RESPONSE'=> codice esito comando, # 'CREDIT'=> credito residuo dell'account se il comando ha avuto esito positivo # function getCredit($volauser, $volapwd, $serial) { // configurazione $sito_web="sms.vola.it"; $porta = 80; $script = "/cgi/volasms_gw_plus2.php"; $credit = -1; $fs = fsockopen($sito_web,$porta); if($fs) { $header =""; $header = $header . "POST $script HTTP/1.0\r\n"; $header = $header . "Host: $sito_web\r\n"; $header = $header . "Content-type: application/x-www-form-urlencoded\r\n"; $volauser = rawurlencode($volauser); // user per vola $volapswd = rawurlencode($volapswd); // password per vola $msg=rawurlencode($msg); //impostazione stringa parametri e sua llunghezza $string = "UID=" . md5($volauser) . "&PWD=" . md5($volapwd) . "&CMD=1&SERIAL=".$serial; $length = strlen($string); $header = $header . "Content-length: $length\r\n\r\n"; $header = $header . $string; // invio i dati al socket fputs($fs,$header); $continue = true; // ricerca del risultato dell'invio while($continue) { $response = fgets($fs); if(ereg("^[0-9]",$response)) { $continue = false; $code = substr($response,0,2); // codice riportato $tmp=split(" ", $response); $credit=$tmp[1]; $res = array ('CODE_RESPONSE'=>$code, 'CREDIT'=>$credit); } } } return $res; } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
<?php # # Esempio di ricezione di messaggi SMS # $user = "xxxxx"; $pwd = "yyyyy"; $key = "zzzzz"; $msgs = getIncomingMessages($user, $pwd, $key); if (count($msgs) > 0) { print_r($msgs); # confermo l'avvenuta ricezione dei mesaggi al server in modo # che alla successiva chiamata di getIncomingMessage # non vengano restituiti gli stessi messaggi ackIncomingMessages($user, $pwd); } exit; # # Funzione conferma ricezione di SMS MO in modo da non restituirli alla successiva # chiamata di getIncomingMessage # function ackIncomingMessages($volauser, $volapwd) { // configurazione $sito_web = "sms.vola.it"; $porta = 80; $script = "/cgi/volasms_gw_plus2.php"; $fs = fsockopen($sito_web, $porta); if ($fs) { $header = ""; $header = $header . "POST $script HTTP/1.0\r\n"; $header = $header . "Host:$sito_web\r\n"; $header = $header . "Content-type: application/x-www-form-urlencoded\r\n"; //impostazione stringa parametri e sua lunghezza $string = "UID=" . md5($volauser) . "&PWD=" . md5($volapwd) . "&CMD=5&SERIAL=TR45GDLBO730HDUIEQJ5"; $length = strlen($string); $header = $header . "Content-length: $length\r\n\r\n"; $header = $header . $string; // invio i dati al socket fputs($fs, $header); $line = TRUE; // ricerca del risultato dell'invio while ($line) { $line = fgets($fs); if (eregi("<body>", $line)) { while ($line) { $line = fgets($fs); if (eregi("<\/body>", $line)) $line = FALSE; else if ($line) $response.=$line; } } } $a_datas = explode(" ", $response); $code = $a_datas[0]; switch ($code) { case "01": $res = TRUE; break; default: break; } } return $res; } # # Funzione che effettua la richiesta al gateway di vola.it e restituiece un array # con l'elenco dei messaggisms MO. # Se non vi sono messaggi, oppure il comando fallisce (username e pwd errati) l'array sara' vuoto. # function getIncomingMessages($volauser, $volapwd, $key) { // configurazione $sito_web = "sms.vola.it"; $porta = 80; $script = "/cgi/volasms_gw_plus2.php"; $a_msg = array(); $fs = fsockopen($sito_web, $porta); if ($fs) { $header = ""; $header = $header . "POST $script HTTP/1.0\r\n"; $header = $header . "Host: $sito_web\r\n"; $header = $header . "Content-type: application/x-www-form-urlencoded\r\n"; //impostazione stringa parametri e sua lunghezza $string = "UID=" . md5($volauser) . "&PWD=" . md5($volapwd) . "&CMD=4&KEY=$key&SERIAL=TR45GDLBO730HDUIEQJ5"; $length = strlen($string); $header = $header . "Content-length: $length\r\n\r\n"; $header = $header . $string; // invio idati al socket fputs($fs, $header); $line = TRUE; // ricerca del risultato dell'invio while ($line) { $line = fgets($fs); if (eregi("<body>", $line)) { while ($line) { $line = fgets($fs); if (eregi("<\/body>", $line)) $line = FALSE; else if ($line) $response.=$line; } } } $a_datas = explode(" ", $response); $code = $a_datas[0]; switch ($code) { case "01": if ($a_datas[1] > 0) { $a_msg = explode("\x1F", substr($response, 3 + strlen($a_datas[1]) + 1)); } break; default: break; } } return $a_msg; } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
<?php # # Esempio di invio di un SMS # // Il numero di cellulare del destinatario deve contente il "+" iniziale $messaggio = "Prova invio messaggio"; $senddata = getSendData("mittente", "+39347xxxxxxx", $messaggio); $res = sendSMS("xxxxx", "yyyyy", $senddata, "TR45GDLBO730HDUIEQJ5"); print_r($res); exit; # # Funzione che restituisce il contenuto del parametro SENDATA opportunamente # valorizzato. # function getSendData($from, $to, $msg) { $res = "0\t$from\t$to\t$msg\t0000-00-00\t00:00\r\n"; return $res; } # # Funzione che effettua l'invio dei dati a gateway. # Viene restituito un array associativo: # 'CODE_RESPONSE'=> codice esito comando, # 'CID'=> identificativo invio lato cliente, # 'ORDERID'=> numero ordine relativo all'invio, # 'TO_ERRORO_LIST' => elenco numeri destinatari non accettati dal gateway # Esempio: # Array #( # [CODE_RESPONSE] => 01 # [CID] => 0 # [ORDERID] => Array # ( # [0] => 17549187 # ) # # [TO_ERRORO_LIST] => Array #( # [0] => # # ) # #) function sendSMS($volauser, $volapwd, $senddata, $serial, $test = 0) { $sito_web = "sms.vola.it"; $porta = 80; $script = "/cgi/volasms_gw_plus2.php"; $ok = false; $fs = fsockopen($sito_web, $porta); if ($fs) { $header = ""; $header = $header . "POST $script HTTP/1.1\r\n"; $header = $header . "Host: $sito_web\r\n"; $header = $header . "Content-type: application/x-www-form-urlencoded\r\n"; $volauser = md5($volauser); $volapwd = md5($volapwd); $senddata = rawurlencode($senddata); $str_data = "TEST=" . $test . "&UID=" . $volauser . "&PWD=" . $volapwd . "&CMD=14&SENDDATA=" . $senddata . "&SERIAL=" . $serial; $length = strlen($str_data); $header = $header . "Content-length: $length\r\n\r\n"; $header = $header . $str_data; fputs($fs, $header); $continue = true; while ($continue) { $response = fgets($fs); if (ereg("^[0-9]", $response)) { $continue = false; $code = substr($response, 0, 2); $tmp = split(" ", $response); $params = $tmp[1]; $tmp = split(";", $params); $cid = $tmp[0]; $lst_orderid = split(",", $tmp[1]); $lst_toerror = split(",", $tmp[2]); $res = array('CODE_RESPONSE' => $code, 'CID' => $cid, 'ORDERID' => $lst_orderid, 'TO_ERRORO_LIST' => $lst_toerror); } } } return $res; } ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
<?php # # Esempio di inserimento di un nuovo mittente # // Impostazioni account Vola $volauser = "xxxxx"; $volapswd = "yyyyyyyy"; $sender = "TESTSENDER"; // Inserimento di un mittente $result = insSender($volauser, $volapswd, $sender, "IT", "Via Lunga 1, MI", "Pippo srl", "+39333xxxxxxx", "02xxxxx", "02xxxxxx", "01234567891", "01234567891", "pippo@email.it"); echo $result; exit; function insSender($volauser, $volapswd, $SENDER, $nazione, $indirizzo, $ragSoc, $telefono, $telCellulare, $fax, $cF, $pI, $email) { $ip = $_SERVER["REMOTE_ADDR"]; $CMD = 34; if (preg_match("'^\+\d+'", $SENDER)) $mittente = "00" . substr($SENDER, 1); else if (preg_match("'^393\d+'", $SENDER) && strlen($SENDER) > 10) $mittente = "00" . $SENDER; else $mittente = $SENDER; $UID = md5($volauser); $PWD = md5($volapswd); $str_data = "UID=" . rawurlencode($UID) . "&PWD=" . rawurlencode($PWD) . "&SERIAL=" . rawurlencode("TR45GDLBO730HDUIEQJ5") . "&CMD=" . $CMD . "&SENDER=" . rawurlencode($SENDER) . "&NAZIONE=" . rawurlencode($nazione) . "&INDIRIZZO=" . rawurlencode($indirizzo) . "&RAG_SOC=" . rawurlencode($ragSoc) . "&TELEFONO=" . rawurlencode($telefono) . "&TELEFONO_CELL=" . rawurlencode($telCellulare) . "&FAX=" . rawurlencode($fax) . "&CF=" . rawurlencode($cF) . "&PI=" . rawurlencode($pI) . "&EMAIL=" . rawurlencode($email); $response = sendCommandToGateway($str_data, $CMD); return $response; } function sendCommandToGateway($params, $cmd) { $url = "http://sms.vola.it/cgi/volasms_gw_plus2.php"; $port = "80"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: sms.vola.it")); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_PORT, $port); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); if (!empty($result)) { curl_close($ch); return $result; }else return null; } ?> |
Esempi di codice ASP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
<!-- #include file = "hex_md5_js.asp" --> <% ' Esempio di richiesta credito residuo SMS Dim resultArray Set resultArray = volaGatewayGetCredit("xxxxx","yyyyy","TR45GDLBO730HDUIEQJ5") responses = split(result," ") for each item in resultArray Response.write item & ": " & resultArray(item) & "<br/>" next ' ' Funzione che effettua la richiesta del credito. ' Viene restituito un array associativo: ' 'CODE_RESPONSE'=> codice esito comando, ' 'CREDIT'=> credito residuo dell'account se il comando ha avuto esito positivo ' function volaGatewayGetCredit(username,password,serial) url = "http://sms.vola.it/cgi/volasms_gw_plus2.php" parameters = "UID=" & Server.urlencode(hex_md5(username)) & "&PWD=" & Server.urlencode(hex_md5(password)) & "&CMD=1&SERIAL=" & serial Dim resArray 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 = 200 Then msg = xmlhttp.responseText set xmlhttp = nothing result = Mid(msg, 17) code = Left(result, 2) temp = split(result, " ") If IsArray(temp) And UBound(temp) > 0 Then credit = temp(1) Else credit = "" End If set resArray=Server.CreateObject("Scripting.Dictionary") resArray.Add "CODE_RESPONSE" ,code resArray.Add "CREDIT" ,credit Set volaGatewayGetCredit = resArray Else set resArray=Server.CreateObject("Scripting.Dictionary") resArray.Add "CODE_RESPONSE" , xmlhttp.Status & " - " & xmlhttp.statusText resArray.Add "CREDIT" , "" Set volaGatewayGetCredit = resArray exit function End If end function %> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
<script language="javascript" type="text/javascript" runat="server"> /* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for more info. */ /* * Configurable variables. You may need to tweak these to be compatible with * the server-side, but the defaults work in most cases. */ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ /* * These are the functions you'll usually want to call * They take string arguments and return either hex or base-64 encoded strings */ function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } /* * Perform a simple self-test to see if the VM is working */ function md5_vm_test() { return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; } /* * Calculate the MD5 of an array of little-endian words, and a bit length */ function core_md5(x, len) { /* append padding */ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } /* * These functions implement the four basic operations the algorithm uses. */ function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } /* * Calculate the HMAC-MD5, of a key and some data */ function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. */ function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); return bin; } /* * Convert an array of little-endian words to a string */ function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; } /* * Convert an array of little-endian words to a hex string. */ function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } return str; } /* * Convert an array of little-endian words to a base-64 string */ function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; } </script> |
I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
<!-- #include file = "hex_md5_js.asp" --> <% 'Esempio di invio di un SMS 'Il numero di cellulare del destinatario deve contente il "+" iniziale messaggio = "Prova invio messaggio" senddata = getSendData("mittente", "+39347xxxxxxx", messaggio) Dim resultArray Set resultArray = volaGatewaySendSMS("xxxxx", "yyyyy", senddata, "TR45GDLBO730HDUIEQJ5", "0") for each item in resultArray Response.write item & ": " & resultArray(item) & "<br/>" next ' ' Funzione che restituisce il contenuto del parametro SENDATA opportunamente ' valorizzato. ' function getSendData(from,dest,messaggio) res = "0" & vbTab & from & vbTab & dest & vbTab & messaggio & vbTab & "0000-00-00" & vbTab & "00:00" & vbNewLine getSendData = res end function ' ' Funzione che effettua l'invio dei dati a gateway. ' Viene restituito un array associativo: ' 'CODE_RESPONSE'=> codice esito comando, ' 'CID'=> identificativo invio lato cliente, ' 'ORDERID'=> numero ordine relativo all'invio, ' 'TO_ERRORO_LIST' => elenco numeri destinatari non accettati dal gateway ' Esempio: ' Array '( ' [CODE_RESPONSE] => 01 ' [CID] => 0 ' [ORDERID] => Array ' ( ' [0] => 17549187 ' ) ' ' [TO_ERRORO_LIST] => Array '( ' [0] => ' ' ) ' ') function volaGatewaySendSMS(username,password,senddata,serial,test) url = "http://sms.vola.it/cgi/volasms_gw_plus2.php" parameters = "TEST=" & test & "&UID=" & Server.urlencode(hex_md5(username)) & "&PWD=" _ & Server.urlencode(hex_md5(password)) & "&CMD=14" _ & "&SENDDATA=" & Server.urlencode(senddata) & "&SERIAL=" & serial Dim resArray 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 = 200 Then msg = xmlhttp.responseText set xmlhttp = nothing result = Mid(msg, 17) code = Left(result, 2) temp = split(result, " ") If IsArray(temp) And UBound(temp) > 0 Then params = temp(1) temp = split(params, ";") cid = temp(0) lst_orderid = split(temp(1), ",") if Not (IsArray(lst_orderid) And UBound(lst_orderid) > 0) Then lst_orderid = temp(1) end if lst_toerror = split(temp(2), ",") if Not (IsArray(lst_toerror) And UBound(lst_toerror) > 0) Then lst_toerror = temp(2) end if Else cid = "" lst_orderid = "" lst_toerror = "" End If set resArray=Server.CreateObject("Scripting.Dictionary") resArray.Add "CODE_RESPONSE" ,code resArray.Add "CID" ,cid resArray.Add "ORDERID" ,lst_orderid resArray.Add "TO_ERRORO_LIST" ,lst_toerror Set volaGatewaySendSMS = resArray Else set resArray=Server.CreateObject("Scripting.Dictionary") resArray.Add "CODE_RESPONSE" , xmlhttp.Status & " - " & xmlhttp.statusText resArray.Add "CID" ,"" resArray.Add "ORDERID" ,"" resArray.Add "TO_ERRORO_LIST" ,"" Set volaGatewaySendSMS = resArray exit function End If end function %> |
Esempi di codice PERL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# # Esempio di invio di SMS # #!/usr/bin/perl -w # # DESCRIZIONE: # Invia un sms utilizzando il gateway di Vola use strict; use Getopt::Long; use vars qw(%ERRORS $PROGNAME $opt_u $opt_p $opt_m $opt_d $opt_s); use IO::Socket; sub print_help (); sub print_usage (); sub send_sms ($$$$$); sub URLEncode ($); sub md5gen($); %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); $PROGNAME = "smssend_vola.pl"; Getopt::Long::Configure('bundling'); GetOptions ( "u=s" => \$opt_u, "user=s" => \$opt_u, "p=s" => \$opt_p, "password=s" => \$opt_p, "m=s" => \$opt_m, "msg=s" => \$opt_m, "d=s" => \$opt_d, "dest=s" => \$opt_d, "s=s" => \$opt_s, "sender=s" => \$opt_s); ($opt_u) || ($opt_u = shift) || usage("Username not specified\n"); ($opt_p) || ($opt_p = shift) || usage("Password not specified\n"); ($opt_m) || ($opt_m = shift) || usage("Message not specified\n"); ($opt_d) || ($opt_d = shift) || usage("Destination not specified\n"); ($opt_s) || ($opt_s = shift) || usage("Sender non specified (ex. use 'SMS')\n"); my $res_send = send_sms($opt_u, $opt_p, $opt_m, $opt_d, $opt_s); if (!$res_send) { exit $ERRORS{'CRITICAL'}; } exit $ERRORS{'OK'}; sub usage { my $format=shift; printf($format,@_); print_help(); exit $ERRORS{'UNKNOWN'}; } sub send_sms($$$$$) { my ($vola_user, $vola_pwd, $msg, $dest, $sender)=@_; my $message=substr($msg,0,160); $sender=substr($sender,0,11); $dest=URLEncode($dest); my $strVolaUser=URLEncode(md5gen($vola_user)); my $strVolaPassword=URLEncode(md5gen($vola_pwd)); $message=URLEncode($msg); my $sock = IO::Socket::INET->new(Proto => 'tcp', PeerAddr => "sms.vola.it", PeerPort => 80, Type => SOCK_STREAM); if (defined($sock)) { # Connection ok $sock->autoflush(1); # Construct the query string to send and determine its length my $str = "CMD=14" . "&UID=$strVolaUser" . "&PWD=$strVolaPassword" . "&TEST=0" . "&SERIAL=TR45GDLBO730HDUIEQJ5" . "&SENDDATA=0\t$sender\t$dest\t$message\t0000-00-00\t00:00\r\n"; my $len = length($str); my $header=""; $header.="POST /cgi/volasms_gw_plus2.php HTTP/1.0\r\n"; $header.="HOST: sms.vola.it\r\n"; $header.="Content-type: application/x-www-form-urlencoded\r\n"; $header.="Content-Length: $len\r\n\r\n"; $header.="$str\r\n"; # # Send request # my $result=-1; $sock->print($header); my $str_risposta=""; while ($_ = <$sock>) { $str_risposta.=($_); } $str_risposta=~/<HTML>\r\n<BODY>\r\n(\d\d)/i; if ($1 eq "01") { $result=1; } $sock->close; return $result; } else { # Connection error return -1; } } sub URLEncode($) { my $theURL = $_[0]; $theURL =~ s/(\W)/"%" . uc(sprintf("%2.2x",ord($1)))/eg; return $theURL; } sub md5gen($) { use Digest::MD5; my $md5 = Digest::MD5->new; $md5->add("$_[0]"); my $digest = $md5->hexdigest; return $digest; } # ------------------------------------------------------------[ print_usage ]-- sub print_usage () { print "Usage: $PROGNAME -u <user> -p <password> -m <message> -d <mobile phone> -s <sender>\n"; } # -------------------------------------------------------------[ print_help ]-- sub print_help () { print($PROGNAME,'$Revision: 1.0 $ '); print "\nCopyright (c) 2012 VOLA S.p.A Send Sms via Gateway VOLA "; print_usage(); print " -u, --user=STRING Username -p, --password=STRING Password -m, --msg=STRING Sms message text (Max: 160 chars) -d, --destination Number of destinations mobile phone (ex. +39347123456 or +393471234567,+393331234567) -s, --sender Sms Sender (Max: 11 chars) "; } |
Esempi di codice JAVA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
/* * Esempio di richiesta credito residuo SMS con utilizzo della VolaSMS Java Class 3.0.1 */ import it.vola.sms.GatewayConnector; import it.vola.sms.GatewayResponse; import it.vola.sms.GatewayResponse.GatewayStatus; import it.vola.sms.Sender; import it.vola.sms.Sms; import java.util.ArrayList; public class TestVolaGw { public static void main(String[] args) { GatewayConnector gw = new GatewayConnector(); //versione della classe System.out.println("VERSIONE: " + gw.getVersion()); // Username e pwd sono case sensitive gw.setUsername("xxxxx"); gw.setPassword("yyyyy"); gw.setTestMode(false); gw.setSslConnection(true); gw.setNotify(false); gw.setLongMessage(true); //Test credito residuo double credit = gw.getCredit(); System.out.println("Credito residuo: " + credit); System.out.println("Risposta ultimo comando: " + gw.getLastCommandResponse().toString()); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
/* * Esempio di richiesta invio SMS con utilizzo della VolaSMS Java Class 3.0.1 */ import it.vola.sms.GatewayConnector; import it.vola.sms.GatewayResponse; import it.vola.sms.GatewayResponse.GatewayStatus; import it.vola.sms.Sender; import it.vola.sms.Sms; import java.util.ArrayList; public class TestVolaGw { public static void main(String[] args) { GatewayConnector gw = new GatewayConnector(); //versione della classe System.out.println("VERSIONE: " + gw.getVersion()); // Username e pwd sono case sensitive gw.setUsername("xxxxx"); gw.setPassword("yyyyy"); gw.setTestMode(false); gw.setSslConnection(true); gw.setNotify(false); gw.setLongMessage(true); GatewayResponse send_res = gw.sendSms("mittente", "+39347xxxxxxx", "test sms", "2013-12-03", "15:00"); if (send_res.getStatus() == GatewayStatus.GW_CMD_OK) { System.out.println("INVIO AVVENUTO CON SUCCESSO - ORDERID: " + send_res.getOrderId()); System.out.println(send_res.toString()); } else { System.out.println(send_res.toString()); } System.out.println("Risposta ultimo comando: " + gw.getLastCommandResponse().toString()); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
/* * Esempio di inserimento di un nuovo mittente SMS con utilizzo della VolaSMS Java Class 3.0.1 */ import it.vola.sms.GatewayConnector; import it.vola.sms.GatewayResponse; import it.vola.sms.GatewayResponse.GatewayStatus; import it.vola.sms.Sender; import it.vola.sms.Sms; import java.util.ArrayList; public class TestVolaGw { public static void main(String[] args) { GatewayConnector gw = new GatewayConnector(); //versione della classe System.out.println("VERSIONE: " + gw.getVersion()); // Username e pwd sono case sensitive gw.setUsername("xxxxx"); gw.setPassword("yyyyy"); gw.setTestMode(false); gw.setSslConnection(true); gw.setNotify(false); gw.setLongMessage(true); String mittente = "TESTSENDER"; String ragSoc = "pippo srl"; String indirizzo = "Via Levante 1 MI"; String nazione = "IT"; String cF = "01234567891"; String pI = "01234567891"; String telefono = "02xxxxxx"; String fax = "02xxxxxx"; String telCellulare = "+39333xxxxxx"; String email = "pippo@email.it"; boolean res_add_sender = gw.addSender(mittente, ragSoc, indirizzo, nazione, cF, pI, telefono , fax, telCellulare, email); System.out.println("Mittente aggiunto " + res_add_sender); System.out.println("Risposta ultimo comando: " + gw.getLastCommandResponse().toString()); } } |