贝宝IPN侦听器HTTP错误405 [英] Paypal IPN listener http error 405

查看:107
本文介绍了贝宝IPN侦听器HTTP错误405的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用精美的文章"
我创建了沙箱帐户,沙箱卖方ipn_pal.htm,设置了要匹配的ipn网址,并在每次收到HTTP错误405方法不允许时都转到了ipn测试站点.
我回到原始的贝宝(Paypal)代码,并删除了所有好东西...相同的错误.

贝宝说这是有问题的房东.主机以前从未见过该问题.我已经在另一个站点(不同的主机)上尝试过,同样的问题.

请告诉我我做错了!谢谢!!!!

我将其简化为:

Using beautiful article "http://www.codeproject.com/Tips/84538/Setting-up-PayPal-Instant-Payment-Notification-IPN.aspx?fid=1573899&df=90&mpp=25&noise=3&sort=Position&view=Quick[^]"

I have created sandbox accounts, sandbox seller, ipn_pal.htm, set the ipn url to match, gone to the ipn test site, every time I get HTTP Error 405 Method Not Allowed.

I went back to the original paypal code and removed all the good stuff... same error.

Paypal says it''s the host that has the problem. The host has never seen the problem before. I have tried it on another site (different host), same problem.

Please tell me what I''ve done wrong! Thanks!!!!

I have it stripped down to this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#"    %>
<%@ Import Namespace = "System" %>
<%@ Import Namespace = "System.IO" %>
<%@ Import Namespace = "System.Text" %>
<%@ Import Namespace = "System.Net" %>
<%@ Import Namespace = "System.Web" %>

<script type="text/javascript" Language="JavaScript">
//Some JavaScript you may need goes here
</script>
<script Language="C#" Option="Explicit" type="text/C#"  runat="server">

protected void Page_Load(object sender, EventArgs e)
{
//Post back to either sandbox or live
string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
string strLive = "https://www.paypal.com/cgi-bin/webscr";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
string strRequest = Encoding.ASCII.GetString(param);
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;
//for proxy
//WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
//req.Proxy = proxy;
//Send the request to PayPal and get the response
StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();
if (strResponse == "VERIFIED")
{
//check the payment_status is Completed
//check that txn_id has not been previously processed
//check that receiver_email is your Primary PayPal email
//check that payment_amount/payment_currency are correct
//process payment
}
else if (strResponse == "INVALID")
{
//log for manual investigation
}
else
{
//log response/ipn data for manual investigation
}
}
  // --- end of page load --
</script>

<html>
<head runat="server" >
<title>IPN PayPal</title>
</head>
<body runat="server">
<label id="debuggy" runat="server"/>
<h2> my test page</h2>
Load this first to check the syntax of your page
</body>
</html>

推荐答案

此代码对我来说效果很好.

POST方法通常会出现405错误,但是并非所有ISP都允许处理该请求所必需的POST方法.
可以将所有405错误归结为Web服务器的配置和控制对网站内容的访问的安全性,因此,您的ISP应该可以轻松地对其进行解释.

由于您发布的代码与
此处 [ ^ ]我将与房东进行交谈,并让他们进行调查,除此之外,您可能需要调查是否需要使用代理和取消注释.代码的代理部分,将"url:port#"部分替换为正确的代理信息(如果您需要使用的是代理).
This code works fine for me.

405 errors often arise with the POST method, however not all ISPs allow the POST method necessary to process the request.
All 405 errors can be traced to configuration of the Web server and security governing access to the content of the Web site, so should easily be explained by your ISP.

As the code you have posted is the same as outlined here[^] on the paypal site I would have a talk with the hosts and get them to investigate, other than that you may want to look into if you need to use a proxy and uncomment the proxy section of the code, replacing the "url:port#" part with the correct proxy information (if you need to use a proxy that is).


这篇关于贝宝IPN侦听器HTTP错误405的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆