PHP as web proxy ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bogdan Zamfir

    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



    and I have my site at



    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


  • Colin McKinnon

    #2
    Re: PHP as web proxy ?

    Bogdan Zamfir wrote:[color=blue]
    >
    > 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.
    >[/color]
    err... something like:

    $replace=array( 'GET');
    $with=array('PO ST');

    foreach($_POST as $name=>$val) {
    $params.=$name . '=' . urlencode($val) . '&';
    }
    $params=substri ng($params,0,-1);
    $in=file_get_co ntents("http://www.webserver.c om/index.htm?$para ms");
    $out=preg_repla ce($replace,$wi th,$in);
    print $out;

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

    HTH

    C.

    Comment

    • Elliot Ali

      #3
      Re: PHP as web proxy ?


      "Bogdan Zamfir" <bzamfir@despam med.com> wrote in message
      news:2m7ofvFirr cmU1@uni-berlin.de...[color=blue]
      > 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[/color]
      to[color=blue]
      > 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[/color]
      the[color=blue]
      > returned HTML page (like changing CSS, adding banners, rewrite form's[/color]
      Action[color=blue]
      > parameter, etc), and will return this page to client.
      >
      > When client will post a page (like clicking on a submit button), my php[/color]
      page[color=blue]
      > will receive it, and pass it to original action URL together with all
      > POST-ed data
      >
      > Any thoughts how t do this?
      >
      > Thanks,
      > Bogdan
      >[/color]
      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?


      Comment

      Working...