help

help

am 05.01.2008 19:06:35 von aotemp

Hi!

Please help!!!

Im using php and Im trying to redirect my users to a new page along
with keeping all of the POST variables...

I tried 2 things

1. Using this echo (below), but I can't figure out how to send along
the post variables..

echo" content='0;URL=http://www.mydomain/myPage.html>Redirecting body>";

-------------

2. Using Curl - note I changed the tunnelling ip address to
xx.xxx.xxx.xxx for this post
but the page doesn't change..

$domain1 = "http://www.mydomain.com/myPage.html";

$ch = curl_init();
curl_setopt ($ch,CURLOPT_URL,$domain1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/
x-www-form-urlencoded", "Content-Length: " . strlen($req)));

curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY, "http://xx.xxx.xxx.xxx:3128");
curl_setopt ($ch, CURLOPT_PORT, 80);

$my_curl_result = curl_exec($ch);

Re: help

am 05.01.2008 19:17:06 von luiheidsgoeroe

On Sat, 05 Jan 2008 19:06:35 +0100, 6e wrote:
> Hi!

Hi!!

> Please help!!!

OK!!!!

> Im using php and Im trying to redirect my users to a new page along
> with keeping all of the POST variables...

Impossible, unless you rely on javascript tricks, at least an external =

redirect.

> I tried 2 things
>
> 1. Using this echo (below), but I can't figure out how to send along
> the post variables..

Forget about this one.

> 2. Using Curl - note I changed the tunnelling ip address to
> xx.xxx.xxx.xxx for this post
> but the page doesn't change..

Should work for displaying the page (except for the relative/absolute =

hrefs/src/targets), what do you mean by 'doesn't change'.

> $domain1 =3D "http://www.mydomain.com/myPage.html";
>
> $ch =3D curl_init();
> curl_setopt ($ch,CURLOPT_URL,$domain1);
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);

Are you sure you want returntransfer?

And why exectly do you need this construct (redirect a post)?
--
Rik Wasmus

Re: help

am 05.01.2008 19:44:44 von aotemp

I want to redirect a post because Im using "instant payment
notification" from paypal, and I want to send the variables that I
verified on the php page to a java servlet page.


in in reference to:
> Are you sure you want returntransfer?
>
> And why exectly do you need this construct (redirect a post)?

I don't know! Do I not want one????

On Jan 5, 1:17=A0pm, "Rik Wasmus" wrote:
> On Sat, 05 Jan 2008 19:06:35 +0100, 6e wrote:
> > Hi!
>
> Hi!!
>
> > Please help!!!
>
> OK!!!!
>
> > Im using php and Im trying to redirect my users to a new page along
> > with keeping all of the POST variables...
>
> Impossible, unless you rely on javascript tricks, at least an external =A0=

> redirect.
>
> > I tried 2 things
>
> > 1. Using this echo (below), but I can't figure out how to send along
> > the post variables..
>
> Forget about this one.
>
> > 2. =A0Using Curl =A0- note I changed the tunnelling ip address to
> > xx.xxx.xxx.xxx for this post
> > =A0 =A0 =A0 =A0 =A0but the page doesn't change..
>
> Should work for displaying the page (except for the relative/absolute =A0
> hrefs/src/targets), what do you mean by 'doesn't change'.
>
> > $domain1 =3D "http://www.mydomain.com/myPage.html";
>
> > $ch =3D curl_init();
> > curl_setopt ($ch,CURLOPT_URL,$domain1);
> > curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
>
> Are you sure you want returntransfer?
>
> And why exectly do you need this construct (redirect a post)?
> --
> Rik Wasmus

Re: help

am 05.01.2008 20:14:40 von Acrobatic

On Jan 5, 12:44 pm, 6e wrote:
> I want to redirect a post because Im using "instant payment
> notification" from paypal, and I want to send the variables that I
> verified on the php page to a java servlet page.

If it's an internal redirect, why don't you write the $_POST variables
to $_SESSION variables, then redirect, then re-access them via the
session? Make sure you use session_write_close() to keep your sanity:

ie

session_start();
$_SESSION['product_name'] = $_POST['product_name'];
$_SESSION['customer_name'] = $_POST['customer_name'];
session_write_close();
header("Location:http://path/to/your/script/");






>
> > Should work for displaying the page (except for the relative/absolute
> > hrefs/src/targets), what do you mean by 'doesn't change'.
>
> > > $domain1 = "http://www.mydomain.com/myPage.html";
>
> > > $ch = curl_init();
> > > curl_setopt ($ch,CURLOPT_URL,$domain1);
> > > curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
>
> > Are you sure you want returntransfer?
>
> > And why exectly do you need this construct (redirect a post)?
> > --
> > Rik Wasmus

Re: help

am 05.01.2008 23:34:15 von Larry Anderson

This is very basic and only handles simple array inputs as well as
straight inputs (anything with named elements or multi-dimensional
array POSTs are not covered here), also there is no security measures
(code injection vulnerability?), etc. add validation as needed also
something at this end and the destination to ensure that the data came
from this script would also be a 'good thing'.


Service has moved!





Sorry the service has moved...


foreach( $_POST[] as $name => $content) {
if(!is_array($content) {
echo '';
}
} else {
foreach( $content as $element ) {
echo '';
}
}
?>
Redirecting to new site.
Please Click "contune" to go to the new
location =>




Re: help

am 06.01.2008 01:28:09 von Allodoxaphobia

On Sat, 5 Jan 2008 10:06:35 -0800 (PST), 6e wrote:
> Hi!

What devilishly _clever_ Subject: content!

But, then, |Organization: http://groups.google.com

Re: help

am 06.01.2008 17:29:44 von todofixthis

Heya, 6e.

CURLOPT_RETURNTRANSFER causes cURL to return the server response
rather than output it directly. You will probably want to remove that
one from your code.

Also, where do you define $req? Make sure it's URL-encoded.

Re: help

am 07.01.2008 13:47:37 von colin.mckinnon

On 5 Jan, 18:06, 6e wrote:
> Hi!
>
> Please help!!!
>
> Im using php and Im trying to redirect my users to a new page along
> with keeping all of the POST variables...
>

You can't.

In the script which catches the POST you could convert the POST vars
to GET vars and redirect to the URL with a constructed query, or store
the POST vars somewhere in the session. Regardless, the POST will be
empty in the redirected page.

HTTP redirection was never intended for this kind of purpose - even
when its done properly (the header('location....) function returns a
302 response which is completely wrong for this in HTTP/1.1 and even
if you use a 307 redirect it messes up lots of stuff.

Stop trying to fix the wrong problem.

C.