如何从 Paypal IPN 处理程序中的另一个 PHP 脚本重定向到/执行 1 个脚本?

发布于 2024-11-25 09:57:13 字数 464 浏览 0 评论 0原文

我在我的网站上设置了 PHP IPN Paypal 通知处理程序,以通知我通过 PayPal 付款。我安装了一个 Joomla,它使用一个精心设计的、未注释且未记录的组件来处理预订。

我知道一旦收到有效的 IPN,我需要使用一系列参数调用某个 PHP 脚本。然而,因为它是 Joomla,所以我的脚本格式如下:

/index.php?option=com_component&controller=contr

虽然显然这不是实际的 PHP 脚本 - 就像我说的,MVC 中的一个复杂的框架。

调用此脚本的最佳方法是什么?我正在考虑使用,

header("Location: index.php?opt...."); 

但是考虑到我之前已经进行了处理(没有输出)并且之后可能进行了处理,我不确定这是否是最好的调用。

感谢这个问题相当迟钝,但任何帮助表示赞赏!

I've set up a PHP IPN Paypal notification handler on my site to notify me of payments through PayPal. I have a Joomla install which uses an elaborate, uncommented and undocumented component for processing bookings.

I know I need to call a certain PHP script with a series of arguments once a valid IPN has been received. However, as it's Joomla I have the script in the form:

/index.php?option=com_component&controller=contr

Though obviously this isn't the actual PHP script - like I say, an elaborate framework in MVC.

What is the best method to then call this script? I was thinking of using

header("Location: index.php?opt...."); 

however given I've got processing before (with no output) and potentially processing after, I'm not sure if this is the best call.

Appreciate this question is rather obtuse, but any help appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒儿 2024-12-02 09:57:13

如果您的服务器上安装/启用了 CURL,您可以尝试使用它。

$ch = curl_init("path/to/your/script.php");

//Include your headers here
$headers = array('');

//Set the data you want to send, as an associative array.
$postData = array("foo" => "bar", 12 => true);

curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
$output = curl_exec($ch);
if($output == FALSE){
    // Error reporting
}
curl_close($ch);

You can try using CURL, if it's installed/enabled on your server.

$ch = curl_init("path/to/your/script.php");

//Include your headers here
$headers = array('');

//Set the data you want to send, as an associative array.
$postData = array("foo" => "bar", 12 => true);

curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
$output = curl_exec($ch);
if($output == FALSE){
    // Error reporting
}
curl_close($ch);
恍梦境° 2024-12-02 09:57:13

您不能依赖 PayPal 来跟踪您的重定向,或者至少我不会。

包含您想要调用的 php 脚本怎么样?

You can't rely on PayPal to follow your redirect, or at least I wouldn't.

How about including the php-script that you want to invoke?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文