我在php中还是个新手。是否可以将传入回发中所有参数转发/发送到另一个回发url?
例如,我收到来自A http://www.a.com?subid=name&country=malaysia&price=usd50的回发url。然后我想将参数从回发url A转发/发送到回发url B http://www.b.com?subid=name&country=malaysia&price=usd50
我知道如何从回发A获取参数并更新数据库。但在这种情况下,我不想更新数据库,我只想将它转发或将从A收到的所有参数值发送到回发B。
发布于 2014-01-13 18:20:38
是的,这绝对是可能的。
//First, grab the POST data
$sub_id = $_GET['subid'];
$country = $_GET['country'];
$price = $_GET['price'];接下来,使用curl,如here所示
$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 );发布于 2014-01-13 18:34:34
你可以试试这个
$pass =substr($_SERVER["HTTP_REFERER"],strlen(strtok($_SERVER["HTTP_REFERER"],"?")));
header("Location: http://www.b.com".$pass);
exit();https://stackoverflow.com/questions/21088675
复制相似问题