<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" >
<input type="hidden" name="business" value="test@test.com" >
<input type="hidden" name="item_name" value="testtest" >
<input type="hidden" name="currency_code" value="USD" >
<input type="hidden" name="amount" value="100.00" >
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0"
name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
protected void Button1_Click(object sender, EventArgs e)
{
string postData = "";
postData += "cmd=_xclick";
postData += "&business=test@test.com";
postData += "&item_name=testtest";
postData += "¤cy_code=USD";
postData += "&amount=100.00";
byte[] data = Encoding.Default.GetBytes(postData);
HttpWebRequest ppRequest = (HttpWebRequest)
WebRequest.Create("https://www.paypal.com/cgi-bin/webscr"); ;
ppRequest.Method = "POST";
ppRequest.ContentType = "application/x-www-form-urlencoded";
ppRequest.ContentLength = data.Length;
Stream ppStream = ppRequest.GetRequestStream();
ppStream.Write(data, 0, data.Length);
ppStream.Close();
HttpWebResponse ppResponse = (HttpWebResponse)ppRequest.GetResponse();
StreamReader sr = new StreamReader(ppResponse.GetResponseStream());
string strResult = sr.ReadToEnd();
sr.Close();
Response.Clear();
Response.Write(strResult);
Response.End();
}
这样提交过去不对。
------解决方案--------------------------------------------------------
我用你的代码 请求时请求过去了
但是显示了
Sorry — your last action could not be completed
不知道是不是LZ的参数有误还是怎么的
------解决方案--------------------------------------------------------
帮顶!