???怎么用PHP发送POST请求??? 乱讲的吧!fopen 是用来打开文件的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你打开网址不是一样吗?带上参数不就可以了吗?那用fputs()吧。用fsockopen连接上,弄一个post的http头,用fputs发送过去就可以了。真是没见识。 用javascript让表单自动提交 要将a.php提交到支付平台:header("Location: Url地址?需要的参数"); 也可以修改模板上html的<form method="POST" ···> lisoon((水翡草芥--突然想去扫街))好像没理解我的意思,请认真看一下问题。uuq(杜牧)讲的我也想过,但我想知道有没有其它办法xxluan(乱乱)的header那不就成GET请求了吗?<form method="POST" ···>这种不还是要用户点击吗?看来只好让用户再点击一次喽~ lisoon((水翡草芥--突然想去扫街))好像没理解我的意思,请认真看一下问题。------------我看是你没理解人家的意思!问题已经说的很清楚了,建议去看一下HTTP协议 给你代码吧,这个是paypal的接口代码。// read the post from PayPal system and add 'cmd'$req = 'cmd=_notify-validate';foreach ($_POST as $key => $value) {$value = urlencode(stripslashes($value));$req .= "&$key=$value";}// post back to PayPal system to validate$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";$header .= "Content-Type: application/x-www-form-urlencoded\r\n";$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);// assign posted variables to local variables$item_name = $_POST['item_name'];$item_number = $_POST['item_number'];$payment_status = $_POST['payment_status'];$payment_amount = $_POST['mc_gross'];$payment_currency = $_POST['mc_currency'];$txn_id = $_POST['txn_id'];$receiver_email = $_POST['receiver_email'];$payer_email = $_POST['payer_email'];if (!$fp) {// HTTP ERROR} else {fputs ($fp, $header . $req);while (!feof($fp)) {$res = fgets ($fp, 1024);if (strcmp ($res, "VERIFIED") == 0) {// 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 (strcmp ($res, "INVALID") == 0) {// log for manual investigation}}fclose ($fp);}?> 我换一种问法!!!http://community.csdn.net/Expert/topic/4559/4559677.xml?temp=.1897547 真无聊……-------------------------a.php<form method=post action=b.php><input name=aaa><br><input name=bbb><br><input name=ccc><br><input type=submit></form>---b.php<?//你在这里处理吧?><form name=test method=post action=c.php><input name=aaa value='<?=$aaa?>'><br><input name=bbb value='<?=$bbb?>'><br><input name=ccc value='<?=$ccc?>'><br><input type=submit></form><script>test.submit();</script>---c.php<?print_r($_POST);?> 如何将数据库中的内容格式化输出到PDF文档 mysql 语句求解! 求助PHPCMS 关于Adodb 关于表单的问题 请问这样写SQL的附加条件会不会有问题 请教高手,判断是否输入为汉字或者英文 能否介绍几个比较好的50M+纯网页+国际域名的空间? 访问MYSQL的问题 是不是php也有权限问题? php怎样处理xml字符串? php + mysql 存图片的问题
带上参数不就可以了吗?
那用fputs()吧。用fsockopen连接上,弄一个post的http头,用fputs发送过去就可以了。
真是没见识。
header("Location: Url地址?需要的参数");
xxluan(乱乱)的header那不就成GET请求了吗?
<form method="POST" ···>这种不还是要用户点击吗?看来只好让用户再点击一次喽~
------------
我看是你没理解人家的意思!问题已经说的很清楚了,建议去看一下HTTP协议
$req = 'cmd=_notify-validate';foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// 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 (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
fclose ($fp);
}
?>
a.php<form method=post action=b.php>
<input name=aaa><br>
<input name=bbb><br>
<input name=ccc><br>
<input type=submit>
</form>---b.php
<?//你在这里处理吧?>
<form name=test method=post action=c.php>
<input name=aaa value='<?=$aaa?>'><br>
<input name=bbb value='<?=$bbb?>'><br>
<input name=ccc value='<?=$ccc?>'><br>
<input type=submit>
</form>
<script>
test.submit();
</script>---
c.php<?
print_r($_POST);
?>