標題可能有點誤導,但我不確定如何以其他方式進行表述。cURL - 傳輸表單很好,但無法從其他服務器獲取變量
我使用下面的腳本發送變量跨服務器:
<?php
if($_POST) {
$ch = curl_init("http://jecom.nl/bank/mods/jecom/jecom.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array('description' => $_POST['description'], 'amount' => $_POST['amount'], 'receiver'=> $_POST['receiver']));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
// set to false if you want to see what redirect header was sent
// snippet 1
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
}
?>
這工作,我也得到了變量jecom.php
其他服務器上。
這是接收頁:
<?php
require_once 'jecom_req.php'; //Basic requirements file
$receiver = ($_POST["receiver"]);
$amount = ($_POST["amount"]);
$description = ($_POST["description"]);
$sender = $_SESSION['username']; //their username.
$balance = get_funds($sender, $server);
?>
<h1>Confirm payment</h1>
<p>Please be carefull to confirm your payment to the other party. All transactions are logged to prevent fraud.</p>
<form name="confirmation" method="post" action="jecom_send.php">
<table width="200" border="1">
<tr>
<td>Your account name:</td>
<td><?php echo $sender; ?></td>
</tr>
<tr>
<td>Current Balance:</td>
<td><?php echo $balance; ?></td>
</tr>
</table>
<hr>
<table width="200" border="1">
<tr>
<td>Receiving party:</td>
<td><?php echo $receiver; ?></td>
</tr>
<tr>
<td>Description:</td>
<td><?php echo $description; ?></td>
</tr>
<tr>
<td>Amount:</td>
<td><?php echo $amount; ?></td>
</tr>
</table>
<hr>
<table width="500" border="1">
<tr>
<td align="center">I hereby confirm this information is correct and want to transfer the money.</td>
</tr>
<tr>
<td align="center"><input name="Submit" type="submit" value="Submit"></td>
</tr>
</table>
<input name="receiver" type="hidden" value="<?php echo $receiver; ?>" />
<input name="description" type="hidden" value="<?php echo $description; ?>" />
<input name="amount" type="hidden" value="<?php echo $amount; ?>" />
<input name="confirmation" type="hidden" value="http://jecom.nl/bank/mods/jecom/confirmation.php" />
</form>
我是從形式獲取值(如預期),但不$sender
和$balance
,還當我按下提交不將它們發送到正確的頁面,但希望在表單服務器上找到jecom_find.php
。現在這並不令我感到意外,我想到了後續部署,但目前這不起作用(openbase_dir
和safe_mode
仍然是一個)。有沒有可能繞過這個?
什麼是get_funds()? –