Translate

Samstag, 11. Januar 2014

Getting ALL! SMS parameters from smstools - by eventhandler activated script

#!/usr/bin/php
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

//übergabeparameter aus smstools3

$sms_type = $argv[1];
$sms_file   = $argv[2];



$sms_file_content = file_get_contents($sms_file);
$i = strpos($sms_file_content, "\n\n");
$sms_headers_part = substr($sms_file_content, 0, $i);
$sms_message_body = substr($sms_file_content, $i + 2);
$sms_header_lines = split("\n", $sms_headers_part);
$sms_headers = array();

foreach ($sms_header_lines as $header)
{
  $i = strpos($header, ":");
  if ($i !== false)
    $sms_headers[substr($header, 0, $i)] = substr($header, $i + 2);
}

// select and get all header informations
$h_vonhandy    = $sms_headers["From"];
$h_toa              = $sms_headers["From_TOA"];
$h_smsc           = $sms_headers["From_SMSC"];
$h_sent             = $sms_headers["Sent"];
$h_received      = $sms_headers["Received"];
$h_subject        = $sms_headers["Subject"];
$h_modem       = $sms_headers["Modem"];
$h_imsi            = $sms_headers["IMSI"];
$h_report         = $sms_headers["Report"];
$h_alfabet         = $sms_headers["Alphabet"];
$h_length          = $sms_headers["Length"];


// your code 2 follow


?>