473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

PHP as web proxy ?

Hi,

I need to use a PHP app as a sort of a web proxy
To be more specific:

I have a mailserver with own web server and web interface. What want it to
be able to dynamically change its output pages (but I cannot interface
directly PHP with its web browser)

So, suppose the web mail server runs on

http://www.webserver.com

and I have my site at

http://www.myphpserver.com

What I need is user to connect to
http://www.myphpserver.com/webserver/index.htm, and when my PHP webserver
receive this request, it will request the page from
http://www.webserver.com/index.htm. Then it will make some processing on the
returned HTML page (like changing CSS, adding banners, rewrite form's Action
parameter, etc), and will return this page to client.

When client will post a page (like clicking on a submit button), my php page
will receive it, and pass it to original action URL together with all
POST-ed data

Any thoughts how t do this?

Thanks,
Bogdan
Jul 17 '05 #1
2 3247
Bogdan Zamfir wrote:

So, suppose the web mail server runs on

http://www.webserver.com

and I have my site at

http://www.myphpserver.com

What I need is user to connect to
http://www.myphpserver.com/webserver/index.htm, and when my PHP webserver
receive this request, it will request the page from
http://www.webserver.com/index.htm. Then it will make some processing on
the returned HTML page (like changing CSS, adding banners, rewrite form's
Action parameter, etc), and will return this page to client.

err... something like:

$replace=array('GET');
$with=array('POST');

foreach($_POST as $name=>$val) {
$params.=$name . '=' . urlencode($val) . '&';
}
$params=substring($params,0,-1);
$in=file_get_contents("http://www.webserver.com/index.htm?$params");
$out=preg_replace($replace,$with,$in);
print $out;

If you want to POST to the back-end, you'll need a lot more code.

HTH

C.
Jul 17 '05 #2

"Bogdan Zamfir" <bz*****@despammed.com> wrote in message
news:2m************@uni-berlin.de...
Hi,

I need to use a PHP app as a sort of a web proxy
To be more specific:

I have a mailserver with own web server and web interface. What want it to be able to dynamically change its output pages (but I cannot interface
directly PHP with its web browser)

So, suppose the web mail server runs on

http://www.webserver.com

and I have my site at

http://www.myphpserver.com

What I need is user to connect to
http://www.myphpserver.com/webserver/index.htm, and when my PHP webserver
receive this request, it will request the page from
http://www.webserver.com/index.htm. Then it will make some processing on the returned HTML page (like changing CSS, adding banners, rewrite form's Action parameter, etc), and will return this page to client.

When client will post a page (like clicking on a submit button), my php page will receive it, and pass it to original action URL together with all
POST-ed data

Any thoughts how t do this?

Thanks,
Bogdan

Actually, similarly to this I am behind a firewall here at work.... :$

I have idly wondered whether something like this could be put together to
stop the firewall banning certain domains (like my webmail), and possibly
even allowing data to be forwarded through to another protocal? For example,
connecting to an IMAP server where the IMAP ports are blocked on the
firewall?

Any ideas?
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I...
2
by: nitrogenycs | last post by:
Hello, I need a way to get a notification whenever a variable of an object changes. The approach should be non-intrusive so that I can use existing objects without modifying them. I want to be...
6
by: harry | last post by:
Hi, I have a program that runs on multiple client pc's. Occasionally one or more of those pc's use VPN to connect to another corporate network. When using VPN they need to set proxy server in...
10
by: Abubakar | last post by:
hi, I work on a computer that is part of a network and uses proxy to connect to net. I cant connect to servers outside my proxy with simple ConnectTo code. I need to know how to make my requests go...
3
by: Codex Twin | last post by:
Hello apologies if this is the wrong newsgroup to be sending this to. Basically, I have an ASP.NET application that I am trying to force to use a proxy server settings. This can be done by...
9
by: Codex Twin | last post by:
I am re-sending this in the hope that it might illicit a response. I have a corporate client who forces their workstations to get the proxy server details using an automatic proxy discovery script....
7
by: Pro1712 | last post by:
Hello, I need to write a simple proxy server. What I want to do is to use HttpListener to get requests from the browser, add some proxy information and some other stuff and send the request to...
7
by: chandru1782 | last post by:
Dear friends, I am trying to use CPAN for installing some perl modules. i am using a ubuntu system, which has internet connection through lan and authenticated proxy. when trying to install...
2
by: =?Utf-8?B?TGVuc3Rlcg==?= | last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to request a resource over HTTPS is failing following the installation of a new proxy server on our internal network with...
2
by: | last post by:
Hi all, I have an asp.net 2.0 website that accesses a locally hosted web service. This works fine on servers that are connected to our network. However, I am having a problem with a laptop...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.