mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-29 12:07:41 +01:00
Added php proxy.
This commit is contained in:
parent
0dca8d9cfe
commit
445f37475a
@ -1,6 +1,7 @@
|
||||
var config = {
|
||||
tileUrl: 'tiles/',
|
||||
updateUrl: 'up/', // For Apache and lighttpd
|
||||
// updateUrl: 'up.php?path=', // For Apache and lighttpd without ability to natively proxy
|
||||
// updateUrl: 'up.aspx?path=', // For IIS
|
||||
tileWidth: 128,
|
||||
tileHeight: 128
|
||||
|
32
web/up.php
Normal file
32
web/up.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
define ('HOSTNAME', 'http://localhost:8123/up/');
|
||||
|
||||
$path = $_GET['path'];
|
||||
$url = HOSTNAME.$path;
|
||||
|
||||
// Open the Curl session
|
||||
$session = curl_init($url);
|
||||
|
||||
// If it's a POST, put the POST data in the body
|
||||
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
|
||||
// Read the input from stdin
|
||||
$postText = trim(file_get_contents('php://input'));
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, $postText);
|
||||
}
|
||||
|
||||
// Don't return HTTP headers. Do return the contents of the call
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// Make the call
|
||||
$body = curl_exec($session);
|
||||
|
||||
header("Content-Type: ".curl_getinfo($session, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
echo $body;
|
||||
curl_close($session);
|
||||
|
||||
?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user