【问题标题】:Form to an other hidden thing with PayPal使用 PayPal 形成另一个隐藏的东西
【发布时间】:2017-12-04 20:00:40
【问题描述】:

好吧,也许解释得不好,但我有这个:

<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”插入返回 url 的内容。 TopUp_amount的人可以自行选择。但我希望它能够返回url。我该怎么做?

【问题讨论】:

    标签: javascript php html paypal


    【解决方案1】:

    您可以将其发送到您自己的 PHP 脚本,然后使用 curl 将其路由到您的原始链接 (PayPal)

    像这样:

    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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      • 2020-07-04
      • 2019-01-05
      相关资源
      最近更新 更多