Re: Forwarding POST info from a PHP script
| From: | Tom Rogers | Date: | Wed, 08 Jan 2003 02:15:48 +0000 |
| Subject: | Re: Forwarding POST info from a PHP script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130679@lists.php.net to get a copy of this message | ||
Hi,
Wednesday, January 8, 2003, 12:29:50 AM, you wrote:
DB> I want to be able to retrieve POST variable in one PHP script (which is
DB> straight-forward) and then send these from the script to another one
DB> returning the processed input.
DB> I have written a script that will parse a frames-based page and render it as
DB> a flat page (i.e. all frames displayed as a table in one HTML file) - this
DB> is so that I can create a website using frames, and still let browsers that
DB> don't support frames to access it without my having to create a separate
DB> version of the site.
DB> e.g.:
DB> http://www.redradish.co.uk/rr/index.htm (frames based site)
DB>
DB> http://www.redradish.co.uk/php/framesprocessor.php?Frameset=http://www.redra
DB> dish.net/rr/index.htm&RenderMethod=1&MainFrame=main&AllHead=1
DB> (the same site
DB> rendered as single page).
DB> The problem is that if in the frames-based site one of the frames is a form
DB> submission, I need to be able to send this data to the original form and
DB> retrieve the output to display in the rendered page.
DB> e.g.
DB>
DB> http://www.redradish.co.uk/php/framesprocessor.php?Frameset=http://www.redra
DB>
DB> dish.net/rr/index.htm&TargetName=main&Target=http://www.redradish.net/rr/con
DB>
DB> tact/contactF.htm&MainFrame=main&RenderMethod=1&LinkSearch=1&AllHead=1&Debug
DB> =1
DB> (this is a page that has a contact form).
DB> I can't find any information on how to forward such a request.
DB> The script in question is located at:
DB> http://www.redradish.co.uk/php/framesprocessor.php
DB> It uses these variables (passed using GET or POST):
DB> Frameset frameset page. This needs to be parsed and a static HTML page
DB> created.
DB> Target (optional) full URL of page to be displayed in frmae named
DB> TargetName.
DB> TargetName (optional) name of the frame that $Target should appear in.
DB> MainFrame (optional) is the frame from which header info, etc. is
DB> taken.
DB> Default is first frame.
DB> AllHead (optional) If set (is 1 or more), copies <HEAD> content from all
DB> frames.
DB> RenderMethod (optional) defines how the frameset is to be represented:
DB> 1 - All frames dumped into new page in order they appear in
DB> frameset.
DB> 2 - tables are used to attempt to recreate original format
DB> Default is 1.
DB> LinkSearch (optional) how links are replaced:
DB> 1 - Only specific tags are replaced
DB> 2 - Anything within quotes (' or ") that contains document path is
DB> replaced
DB> Default is 1.
DB> Debug If set (greater than 0), debug info is added in comments.
DB> It works to a good degree on most frames-based sites, but does have a couple
DB> of failings (such as the one mentioned) that I would like to overcome.
DB> The other problem is handling JavaScript in e.g. <frame
DB> src="JavaScript:openpage(xx)">. There is no way to process JavaScript in
DB> PHP that I am aware of - does anyone have a workaround for this? i.e. so
DB> that my script can process the JavaScript function and retrieve the relevant
DB> page for inclusion in the rendered page.
DB> Hope someone can help!
DB> Thanks.
DB> Dave
I would do it like this:
$posted = base64_encode(serialize($_POST)));
echo '<input type="hidden" name="posted"
value="'.$posted.'">';
on the receiving end you need:
$posted = unserialize(base64_decode($_POST['posted']));
--
regards,
Tom