贝宝webhooks到达服务器,但价值观是空的

问题描述:

我试图使用webhook模拟器来确保信息至少使它在我们的服务器前前进。好消息是,在我的日志中,我看到请求有些东西,但问题是所有变量都是空白的。我正在使用php,根据我的打印输出,$ _GET,$ _POST和$ _REQUEST都是空数组。任何人有关于如何解决这个特定问题的任何提示?贝宝webhooks到达服务器,但价值观是空的

以下是我们服务器上的唯一代码(同样,只是想查看数据是否成功)。事件发生后

<?php 
    function write_to_log($text) { 
     try { 
      $file = fopen("../../../paypal_test_log.txt", "a"); 
      $text = date("m/d/Y H:i:s") . " -- " . $text . "\n"; 
      fwrite($file, $text); 
      fclose($file); 
     } catch(Exception $e) { 
      echo 'error<br/>'; 
      echo $e->getMessage(); 
     } 
    } 
    header('HTTP/1.1 200 OK'); 
    write_to_log('===============================================testing post'); 
    write_to_log(print_r($_POST, true)); 
    write_to_log('===============================================get'); 
    write_to_log(print_r($_GET, true)); 
    write_to_log('===============================================request'); 
    write_to_log(print_r($_REQUEST, true)); 
?> 

服务器日志:

07/14/2016 15:07:22 -- 
===============================================testing post 07/14/2016 15:07:22 -- Array () 

07/14/2016 15:07:22 -- 
===============================================get 07/14/2016 15:07:22 -- Array () 

07/14/2016 15:07:22 -- 
===============================================request 07/14/2016 15:07:22 -- Array () 
+0

你能后的代码相关位让我们看看?这将有助于缩小问题所在。 – Kyle

+0

该帖子已更新。 –

为了让你不得不使用的PHP://输入“请求主体,例如的file_get_contents( 'PHP://输入');

要验证请求授权,你必须检查$ _SERVER全局数组