PHP paypal实现 有详细的,细节的实现流程代码?问的比较无耻,不好意思的。。只需要和PAYPAL相关的必要的,其它请隐藏或者更改,跪求~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php// 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 ('ssl://www.paypal.com', 443, $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);}?>POST回Paypal的接口地址,如果数据正确,那么Paypal返回字符串VERIFIED,否则为INVALID,如果结果为VERIFIED,那么你的程序就可以使用这些数据进行操作。 希望对你有帮助:里面有资源下载,没全部上传,如有需要请在文章处留下联方式,我发你邮箱http://blog.csdn.net/yw1386/archive/2010/04/10/5471258.aspx 小弟也急需paypal的资料,请发我,[email protected] 急急读取数据赋值代码再赋值??? 内容管理系统 求php操作Real Alternative,插件详解 查询结果重复求帮助!!! 请问下到哪里可以下载php博客模板? 逆波兰表达式计算 品牌空间二次开发的高手请进 PHP配置好环境 运行空文件报错了 php获取浏览历史记录 dedecms修改默认模板管理的head.html中的内容报错,您提交的内容中或访问的内容中含有系统不允许的关键词或者您的ip受到了访问限制 我的学习历程 求热心人帮我看一下这个问题
// 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 ('ssl://www.paypal.com', 443, $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);
}
?>
POST回Paypal的接口地址,如果数据正确,那么Paypal返回字符串VERIFIED,否则为INVALID,如果结果为VERIFIED,那么你的程序就可以使用这些数据进行操作。