Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何获得paypal自适应支付IPN帖子?_Php_Paypal_Paypal Sandbox_Paypal Ipn - Fatal编程技术网

Php 如何获得paypal自适应支付IPN帖子?

Php 如何获得paypal自适应支付IPN帖子?,php,paypal,paypal-sandbox,paypal-ipn,Php,Paypal,Paypal Sandbox,Paypal Ipn,所以我让我的PHP IPN脚本工作,现在我只是不知道如何获得post值?Paypal以如下数组的形式返回帖子 transaction[0].is_primary_receiver=false &transaction[0].id_for_sender_txn=50E02759CC687801U &log_default_shipping_address_in_transaction=false &transaction[0].receiver=xxxxxxxxxx@gma

所以我让我的PHP IPN脚本工作,现在我只是不知道如何获得post值?Paypal以如下数组的形式返回帖子

transaction[0].is_primary_receiver=false
&transaction[0].id_for_sender_txn=50E02759CC687801U
&log_default_shipping_address_in_transaction=false
&transaction[0].receiver=xxxxxxxxxx@gmail.com
&action_type=PAY
&transaction[1].status=Completed
$payment_status = $_POST['transaction'][1]['status']
显然还有更多,但你明白了,我试着像这样访问帖子的状态

transaction[0].is_primary_receiver=false
&transaction[0].id_for_sender_txn=50E02759CC687801U
&log_default_shipping_address_in_transaction=false
&transaction[0].receiver=xxxxxxxxxx@gmail.com
&action_type=PAY
&transaction[1].status=Completed
$payment_status = $_POST['transaction'][1]['status']
但这不起作用,它返回第一个字母C。
因此,我如何访问它们的值。

通过一点搜索,我发现此链接非常有用:

本页最相关的部分:

// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// Instead, read raw POST data from the input stream. 
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
    $keyval = explode ('=', $keyval);
    if (count($keyval) == 2)
        $myPost[$keyval[0]] = urldecode($keyval[1]);
}

稍加搜索,我发现此链接非常有用:

本页最相关的部分:

// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// Instead, read raw POST data from the input stream. 
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
    $keyval = explode ('=', $keyval);
    if (count($keyval) == 2)
        $myPost[$keyval[0]] = urldecode($keyval[1]);
}

我不得不在上面的脚本中添加一个额外的东西。在URL解码$keyval[1]的地方,我还必须对索引$keyval[0]进行URL解码。原因是,对于类似事务[1].status的内容,如果不进行URL解码,则会将其设置为事务%5B1%5D.status。除此之外,它工作得很好,我只是使用for语句来迭代每个交易,将价格相加并检查它,然后得到txn_id和其他东西。太好了!你明白了;我不得不在上面的脚本中添加一个额外的东西。在URL解码$keyval[1]的地方,我还必须对索引$keyval[0]进行URL解码。原因是,对于类似事务[1].status的内容,如果不进行URL解码,则会将其设置为事务%5B1%5D.status。除此之外,它工作得很好,我只是使用for语句来迭代每个交易,将价格相加并检查它,然后得到txn_id和其他东西。太好了!你明白了;