MT SMS (php)

Space Search
Searching Messaging API
Table of Contents

Here's just a simple example for sending sms using php. Example is in Finnish.

<?php
$viesti = "Miten menee";

$tunnus="KÄYTTÄJÄTUNNUKSESI";
$salasana="SALASANASI";
$recipient="PUHELINUMERO"; # viestin vastaanottaja
# Tämä tulee viestin lähettäjäksi (16 numeroa tai 11 kirjainta (ascii))
$sender="LÄHETTÄJÄ";

$fp = fsockopen("gw1.roottori.fi",80, $errno, $errstr, 30);
if (!$fp) {
  echo "$errstr ($errno)<br />\n";
} else {
  $out = "POST /eapi/push?l=$tunnus&p=$salasana&msisdn=$recipient&from=$sender HTTP/1.1\r\n";
  $out .= "Host: gw1.roottori.fi\r\n";
  $out .= "Content-Type: text/plain\r\n";
  $out .= "Content-length: " . strlen($viesti) . "\r\n";
  $out .= "Connection: Close\r\n\r\n";
  $out .= $viesti;
  fwrite($fp, $out);
  while (!feof($fp)) {
    echo fgets($fp, 128);
  }
  fclose($fp);
}

?>

Labels

 
(None)