我还是php的新手。 是否可以将所有参数从传入的回发转发/发送到另一个回发网址?
示例,我从A http://www.a.com?subid=name&country=malaysia&price=usd50收到回传网址。 然后我想转发/发送参数从回发网址A到回发网址B http://www.b.com?subid=name&country=malaysia&price=usd50
我知道如何从回发A中获取参数并更新数据库。但在这种情况下,我不想更新数据库,我只是希望它转发或将从A收到的所有参数值发送到回发B。
答案 0 :(得分:0)
是的,这绝对是可能的。
//First, grab the POST data
$sub_id = $_GET['subid'];
$country = $_GET['country'];
$price = $_GET['price'];
接下来,使用如here
所示的curl$url = 'http://www.someurl.com';
$myvars = 'subid=' . $sub_id. '&country=' . $country . '&price=' . $price;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
答案 1 :(得分:0)
你可以试试这个
$pass =substr($_SERVER["HTTP_REFERER"],strlen(strtok($_SERVER["HTTP_REFERER"],"?")));
header("Location: http://www.b.com".$pass);
exit();