开发者

move to the target URL after PHP CURL form submit

I'm new to this. I have just discovered curl. Looks like I'm missing something.

Here's the idea.

  1. HTML page has a form with one hidden field that POSTs it to a php file (order.php) after a user clicks SUBMIT.

  2. order.php then generates a bunch of other parameters and POSTs them to a different php file (ordercheck.php)

  3. ordercheck.php uses the POSTed data.

This almost works.

BUT: the problem is that the browser still shows order.php in the address field.

Is there开发者_如何学Go a way for the browser to move to ordercheck.php after order.php has POSTed?

Eventually, I would like to move from order.php to a different server (paypal's webscr), so simply processing the data is not good enough for me. I need to actually post the data AND move to the new url, as if it were a normal form submission...

PLEASE help!


yes simply add a redirect after the curl request like so

header("Location: newPage.php");

Id probably do a check to make sure the curl request was successful then add the header within the php code which will redirect the user.

if your curl request is initialised with a variable like $ch then just do somethign like:

if ($ch){
   header("Location: newPage.php");
}

This wil make sure the curl request reutrned true and completed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜