cURL - 传输表单很好,但无法从其他服务器获取变量

问题描述:

标题可能有点误导,但我不确定如何以其他方式进行表述。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_dirsafe_mode仍然是一个)。有没有可能绕过这个?

+0

什么是get_funds()? –

如果其跨服务器的$ _SESSION变量不会被设置在第二台服务器上。所以它将永远是空的,所以,你永远不会得到平衡,因为你的呼叫

$balance = get_funds(NULL , $server); 
+0

我们如何知道get_funds不使用json数据? –

+0

它可能是。但是如果没有设定他的变量,这并不重要。 –

+0

其他服务器上的会话应该已被设置。 –