-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsoap.php
More file actions
99 lines (92 loc) · 4.28 KB
/
soap.php
File metadata and controls
99 lines (92 loc) · 4.28 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/*
* This file is part of SplashSync Project.
*
* Copyright (C) Splash Sync <www.splashsync.com>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This is Head include file for Splash PHP Module on WebService Request
*/
use Splash\Core\Client\Splash;
use Splash\Core\Server\SplashServer;
//====================================================================//
// Disable Response Caching
header("Cache-Control: max-age=0, private, no-cache, no-store, must-revalidate, no-transform");
//====================================================================//
// Splash Module & Dependencies Autoloader
if (is_file(dirname(__FILE__)."/vendor/autoload.php")) {
require_once(dirname(__FILE__)."/vendor/autoload.php");
} elseif (is_file(dirname(__FILE__, 3)."/autoload.php")) {
require_once(dirname(__FILE__, 3)."/autoload.php");
}
//====================================================================//
// Setup Php Specific Settings
//ini_set('display_errors', "0");
error_reporting(E_ERROR);
//====================================================================//
// Notice internal routines we are in server request mode
define("SPLASH_SERVER_MODE", 1);
//====================================================================//
// Turn on output buffering
ob_start();
//====================================================================//
// SERVER MODE - Answer NuSOAP Requests
//====================================================================//
// Detect NuSOAP requests send by Splash Server
$userAgent = Splash::input("HTTP_USER_AGENT");
if ($userAgent && (false !== strpos($userAgent, "SOAP"))) {
//====================================================================//
// Clean Output Buffer
ob_clean();
//====================================================================//
// Declare WebService Available Functions
require_once(dirname(__FILE__)."/src/Resources/includes/server.inc.php");
Splash::log()->deb("Splash Started In Server Mode");
//====================================================================//
// Build SOAP Server & Register a method available for clients
Splash::com()->buildServer();
//====================================================================//
// Register shutdown method available for fatal errors retrieval
register_shutdown_function(array(SplashServer::class, 'fatalHandler'));
//====================================================================//
// Clean Output Buffer
ob_get_clean();
ob_get_clean();
//====================================================================//
// Force UTF-8 Encoding & Protect against Varnish ESI Transform
if (function_exists('getallheaders') && array_key_exists("X-Varnish", getallheaders())) {
echo "\xEF\xBB\xBF";
}
//====================================================================//
// Process methods & Return the results.
Splash::com()->handle();
} elseif (Splash::input("node", INPUT_GET) === Splash::configuration()->WsIdentifier) {
Splash::log()->deb("Splash Started In System Debug Mode");
//====================================================================//
// Turn on output buffering
ob_end_flush();
//====================================================================//
// Setup Php Errors Settings
ini_set('display_errors', "1");
error_reporting(E_ALL);
//====================================================================//
// Force UTF-8 Encoding & Protect against Varnish ESI Transform
if (function_exists('getallheaders') && array_key_exists("X-Varnish", getallheaders())) {
echo "\xEF\xBB\xBF";
}
//====================================================================//
// Output Server Analyze & Debug
echo SplashServer::getStatusInformations();
//====================================================================//
// Output Module Complete Log
echo Splash::log()->getHtmlLogList();
} else {
echo "This WebService Provide no Description";
}