日期:2014-05-17 浏览次数:20489 次
<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();
}