Drake CMS Official Forums - read-only archive

You are reading the Drake CMS Official Forums archive, available for historical purposes only.

Drake CMS has been rebranded into Lanius CMS, visit the new Lanius CMS Official Forums if you need support about Lanius CMS or Drake CMS -> Lanius CMS migration.



Home page Off-topic Dicussions > How to implement the ProxyPass from Apache in PHP? Permanent link to this page
 
 
Author Message:
aslinux
How to implement the ProxyPass from Apache in PHP?
27 July 2007 12:42
Anonymous I want to host a webpage behind my apache (internal network) and also use the drake user managment.

i dont want to configure the apache via ProxyPass or RewriteRules because everyone can host the webpage behind my apache!

my current solution in PHP (rewriting url´s with str_replace) doesn´t really wrap the page like Apache-ProxyPass!

here my "servicexyz/start.php":
Code:

<?php
$urlmaker = 0;
$myurl = "http://192.168.0.5:8008/";

if ( count( $_POST ) >= 1 )
{
// always empty!
}

if ( count( $_GET ) >= 1 )
{
// preparing the new url

foreach( $_GET as $key=>$val )
{
if ( $key != "remotefile" )
{
if ( $urlmaker == 0 )
{
$urlmaker = 1;
$myurl = $myurl."?";
}
$myurl = $myurl.$key."=".$val;
}
else
{
$myurl = $myurl.$val;
}
}
}

// load
$data = file_get_contents($myurl);

// rewrite included url`s
$datanew = str_replace("src=\"", "src=\"servicexyz/start.php?remotefile=", $data);
$datanew = str_replace("href=\"", "href=\"servicexyz/start.php?remotefile=", $datanew);

// my wrapped page
echo $datanew;
?>


any ideas?
 
Top