2017-06-30 52 views
0
的其他隱藏的東西

好吧,也許不是很好的解釋,但我有這樣的:形式與貝寶

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> 
 
<input type="hidden" name="cmd" value="_xclick"> 
 
<input type="hidden" name="business" value="<?php echo $output['Private']; ?>"> 
 
<input type="hidden" name="return" value="http://MYWEBSITE/index.php?code=succes&bruh=<?php echo $userid; ?>&money="> 
 
<input type="hidden" name="lc" value="US"> 
 
<input type="hidden" name="item_name" value="Topup"> 
 
<input type="hidden" name="currency_code" value="USD"> 
 
<input type="hidden" name="button_subtype" value="services"> 
 
<input type="hidden" name="no_note" value="0"> 
 
<input type="hidden" name="bn" value="PP-BuyNowBF:Buy%20Now%20Button.png:NonHostedGuest"> 
 
<table> 
 
<tbody><tr><td><input type="hidden" name="on0" value="TopUp_amounth">How much?</td></tr><tr><td><input type="text" name="amount" maxlength="200">$</td></tr> 
 
</tbody></table> 
 
<input type="submit" value="Top Up" name="submit"> 
 
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> 
 
</form>

現在我想一個方法來獲得它們插入什麼「TopUp_amounth」成返回網址。 TopUp_amount人可以自己選擇。但我希望它得到在返回url到。我該怎麼做呢?

回答

0

您可以用curl

喜歡這個發送到您自己的PHP腳本,並擊潰到您的原單鏈接(貝寶):

if(isset($_POST['cmd'])){ 
$url = 'https://www.paypal.com/cgi-bin/webscr'; 
$fields = array(
    'cmd' => urlencode($_POST['cmd']), 
    'business' => urlencode($_POST['business']), 
    'return' => urlencode($_POST['return']), 
    [...] 
); 

//url-ify the data for the POST 
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
rtrim($fields_string, '&'); 

//open connection 
$ch = curl_init(); 

//set the url, number of POST vars, POST data 
curl_setopt($ch,CURLOPT_URL, $url); 
curl_setopt($ch,CURLOPT_POST, count($fields)); 
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); 

//execute post 
$result = curl_exec($ch); 

//close connection 
curl_close($ch); 
} 

而且你的HTML表單:

<form action="#" method="post" target="_top"> 
your form 
</form>