PHP
<?php function send_sms($from, $to, $message) { // Set your account username and password here $username = "User"; $password = "Pass"; $base_url = "https://get.spiricom.spirius.com:55001/cgi-bin/sendsms"; $query = $base_url. "?User=".urlencode($username). "&Pass=".urlencode($password). "&To=" .urlencode($to). "&From=".urlencode($from). "&Msg=" .urlencode($message); $response = file_get_contents($query, false); if (!strstr($http_response_header[0],"202 Accepted")) { return $http_response_header[0]; } return $response; } echo send_sms ("+46123456789", "+46123456789", "Hello") . "\n"; ?>
PHP using Curl
<?php /* SPIRIcom HTTP GET PHP example This script requires CURL. For instructions on installation please visit http://www.php.net/manual/en/book.curl.php. */ /* Change this to your username */ $user = "myuser"; /* Change this to your password */ $pass = "mypass"; /* Recipient */ $to = "+467123456789"; /* From number to be displayed in receiving handset */ $from = "+467123456789"; /* The actual message */ $msg = "test"; /* Prepare the GET-request */ $ch = curl_init("http://get.spiricom.spirius.com:55000/cgi-bin/sendsms?User=$user&Pass=$pass&To=$to&From=$from&Msg=$msg"); /* Tell curl that we are interested in the response */ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); /* Send the GET-request */ $result = curl_exec ($ch); print($result); /* Close the connection */ curl_close ($ch); ?>