-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathebtwriter.php
56 lines (51 loc) · 1.07 KB
/
ebtwriter.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
49
50
51
52
53
54
55
56
<?php
/**
* EBTWriter
*
* Creates files to interact with SMS Server Tool v3.
*
* @author Erick Birbe <[email protected]>
* @date 2015-09-03
*/
require_once('ebtglobal.php');
class EBTWriter extends EBTGlobal
{
private $_headers;
private $_message;
private $_content;
function __construct($headers, $msg = "")
{
parent::__construct();
$this->_headers = $headers;
$this->_message = $msg;
$this->_set_content();
return $this;
}
protected function _set_content()
{
$this->_content = "";
foreach ($this->_headers as $key => $value)
{
$this->_content .= $key . ": " . $value . "\n";
}
$this->_content .= "\n" . $this->_message;
}
function get_content()
{
return $this->_content;
}
function write()
{
$sRndCode = substr(str_shuffle(MD5(microtime())), 0, 6);
$fname = $this->config->outgoing . '/' . date('YmdHis') . '.' . $sRndCode . $this->config->sms_ext;
$hFile = fopen($fname, 'w');
if ($hFile)
{
if ( ! fwrite($hFile, $this->_content))
{
throw new Exeption("Unable to write SMS to file " . $fname);
}
}
return $this;
}
}