forked from smartdev0612/AS2_Sender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.php
42 lines (39 loc) · 1.21 KB
/
server.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
<?php
/**
* Copyright (c) 2017 Brett Patterson
*
* @author Brett Patterson <bap14@users.noreply.github.com>
*/
require_once('vendor/autoload.php');
use PHPAS2\Server;
use PHPAS2\Message\Adapter;
if (
array_key_exists('REQUEST_METHOD', $_SERVER) &&
in_array($_SERVER['REQUEST_METHOD'], ['PUT', 'PUSH', 'POST'])
) {
try {
$server = new Server('phpas2test');
$server->processRequest();
$server->sendResponse();
}
catch (\Exception $e) {
echo 'An error has occurred: ' . $e->getMessage();
}
} else {
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo Adapter::getSoftwareName(); ?></title>
<meta name="description" content="<?php Adapter::getSoftwareName(); ?>" />
<meta name="copyright" content="<?php Adapter::getSoftwareName(); ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h2><?php echo Adapter::getSoftwareName(); ?> - Local</h2>
<p>You have performed an HTTP GET request. To submit an AS2 message you must send a POST request.</p>
<p>Copyright © 2017 - <a href="https://www.phpas2.com/">phpas2\phpas2</a></p>
</body>
</html>
<?php
}