dongpang1898 2013-10-02 03:17
浏览 43
已采纳

MAMP中的HTTP状态405

I have a local version of a client's site running in a Wordpress installation on my machine with MAMP. The website contains a PayPal donation form that was written by another developer but left unfinished until the client had set up a PayPal account. The client now has the account, and has hired me to make the donation form "live." Obviously I want to test this before I flip the switch to make it live on their site. When I attempt to submit the form to my PayPal Sandbox account for testing, the browser goes to the correct URL, but I receive the following error message in the browser:

HTTP Status 405 - Request method 'POST' not supported

According to PayPal's documentation, the form's method must be "Post." Also, I've tested other sites with similar PayPal forms successfully on this installation of MAMP. My question is: is there a bug in the code that I'm not catching (as I said, I didn't write this), or is there a server permission that I need to change in MAMP? If the latter, how do I change server permissions in MAMP, because I can't seem find that option anywhere.

Here's the code that's submitting to PayPal:

                      <form method="post" action="https://www.sandbox.paypal.com">
                        <div id="small-button-container" class="">
                            <div id="twenty-five" class="lightred general_button blue_button form_small_button selected_amount select_state_color_btn"><span>25</span></div>
                            <div id="fifty" class="general_button blue_button form_small_button select_state_color_btn"><span>50</span></div>
                            <div id="one-hundred" class="general_button blue_button form_small_button select_state_color_btn"><span>100</span></div>
                            <div id="two-hundred" class="general_button blue_button form_small_button select_state_color_btn"><span>200</span></div>
                        </div>
                        <div id="other-amount" class="general_button blue_button form_other_amount">
                            <span><img src="<?php $root ?>/images/close.png"/>
                            </span>
                            <label>$</label><input class="whitetext" type="text" name="other-amount" value="143">
                        </div>
                        <div id="other-amount-button" class="general_button blue_button select_state_color_btn">
                            <span>OTHER</span>
                        </div>


                            <input type="hidden" name="LOGIN" value="(Sandbox Test Account Here)">
                            <input type="hidden" name="PARTNER" value="PayPal">
                            <input id="donation-amount" type="hidden" name="AMOUNT" value="0">
                            <input id="donation_description" type="hidden" name="DESCRIPTION" value="Tax deductible donation to (Client's Name Here) (Tax Identification Number: XXXX)">
                            <input type="hidden" name="TYPE" value="S">
                            <input class="general_button blue_button submit_button" id="submit" type="submit" value="Donate">
                      </form>

Note: There's a lot of other stuff in this code, because it's set up to calculate the amount of donation selected before submitting.

  • 写回答

1条回答 默认 最新

  • dongpochi9741 2013-10-05 01:04
    关注

    It turns out I had a couple of issues with the code that was causing the issue, and none of it involved server configuration. Per PayPal's documentation, here's what the form should have looked like:

         <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
                <input type="hidden" name="cmd" value="_s-xclick">
                <input type="hidden" name="hosted_button_id" value="(your PayPal key here)">
                <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
         </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码