DOCUMENTAZIONE API SMS STAR
Di seguito vediamo un esempio di script PHP per eseguire le seguenti funzioni:
INVIO SMS
RICEVERE
STATO DEL SMS INVIATO
RICEVERE
COSTO DEL SMS
INVIATO
RICEVERE
IL SALDO DEI CREDITI A DISPOSIZIONE
Prima di visualizzare l'esempio di script riportato qui di seguito leggi le impostazioni da effettuare nel tuo pannello di controllo. Trovi tali indicazioni nella pagina: http://www.smsstar.it/api.htm
ESEMPIO SCRIPT 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 |
<?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>SEND</operation> </operations> <authentification> <username></username> <password></password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID= "msg11" >393333333333</number> </numbers> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_URL=> 'https://www.smsstar.it/account/xml.php' , CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
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 | <?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>GETSTATUS</operation> </operations> <authentification> <username></username> <password></password> </authentification> <statistics> <messageid>msg11</messageid> </statistics> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_URL=> 'https://www.smsstar.it/account/xml.php' , CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
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 | <?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>GETPRICE</operation> </operations> <authentification> <username></username> <password></password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID= "msg11" > 393333333333 </number> </numbers> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_URL=> 'https://www.smsstar.it/account/xml.php' , CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
RICEVERE IL SALDO DEI CREDITI A DISPOSIZIONE
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 | <?php $src = '<?xml version= "1.0" encoding= "UTF-8" ?> <SMS> <operations> <operation>BALANCE</operation> </operations> <authentification> <username></username> <password></password> </authentification> </SMS>'; $Curl = curl_init(); $CurlOptions = array ( CURLOPT_URL=> 'https://www.smsstar.it/account/xml.php' , CURLOPT_FOLLOWLOCATION=>false, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_RETURNTRANSFER=>true, CURLOPT_CONNECTTIMEOUT=>15, CURLOPT_TIMEOUT=>100, CURLOPT_POSTFIELDS=> array ( 'XML' => $src ), ); curl_setopt_array( $Curl , $CurlOptions ); if (false === ( $Result = curl_exec( $Curl ))) { throw new Exception( 'Http request failed' ); } curl_close( $Curl ); echo $Result ; ?> |
ESEMPI DI SCRIPT PER INVIARE SMS TRAMITE IL GATEWAY DI SMSSTAR
Script in PHP per Inviare SMS
Script in C# per Inviare SMS
Script in Java per Inviare SMS
Script in Perl per Inviare SMS
Script in Python per Inviare SMS