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
<?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";

?>
Back to top