<? //////////////////sms_sender.php////////////////// //PURPOSE: SEND SMS USING KDEV GATEWAY // //AUTHOR: Davide Cantaluppi <kanta@kdev.it> // //V2-Rev. 0 // //PLATFORM: Not platform dependent // //DEPEND: PHP >4.1.2; libcurl extension // // Secured SSL // //Keep parameters in a safe place // //////////////////sms_sender.php////////////////// //OUTPUT of the call //https://www.smskdev.it/send.php?user=utente&passkey=password&to=39XXXXXXX&text=messaggio+test //PARAMETERS $username="username"; $password="password"; $to="39destinatario"; $text="testo del messaggio"; //function for send.php call in POST require curl compiled inside PHP //DEFAULT CHOICE function do_post_request($url, $data, $optional_headers = null) { $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) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; } $urlPost='https://www.smskdev.it/send.php'; $params='user='.urlencode($usename).'&passkey='.urlencode($passkey).'&to='.urlencode($to)."&text=".urlencode($text); $response=do_post_request($urlPost, $params); echo $response; ?>