-
Notifications
You must be signed in to change notification settings - Fork 0
/
ebtreader.php
48 lines (44 loc) · 904 Bytes
/
ebtreader.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* EBTReader
*
* Reads files in SMS Server Tool v3 format.
*
* @author Erick Birbe <[email protected]>
* @date 2015-09-04
*/
require_once('ebtglobal.php');
class EBTReader extends EBTGlobal
{
var $filename;
function __construct($file)
{
parent::__construct();
$this->filename = $file;
}
function read()
{
if (is_file($this->filename) and is_readable($this->filename))
{
$hFile = fopen($this->filename, 'r');
$iSize = filesize($this->filename);
if (!$hFile)
{
return FALSE;
}
if ($sContent = fread($hFile, $iSize))
{
return $sContent;
}
}
return FALSE;
}
}
// ---------------------------------------------------------------------
// MAIN
// ---------------------------------------------------------------------
if (!debug_backtrace())
{
$obj = new EBTReader('/var/spool/sms/incoming/2015-09-03.GSM1.0CMrMT');
echo $obj->read();
}