heartleed影响itunes的第三方php服务器接收验证


heartbleed affect the 3rd party php server receipt verify of itunes?

我有一个工作的第三方php代码来验证从ipad发送的收据。但看起来https://sandbox.itunes.apple.com/verifyReceipt对我的php代码没有太长的响应。如果我直接访问url,甚至不会有像{"status":21000}这样的错误统计。我在服务器端尝试了不同的方法,比如curl_exec($ch);或file_get_contents即使是简单的测试也不会得到任何回报。

$result = file_get_contents('https://sandbox.itunes.apple.com/verifyReceipt');
echo $result;

我想知道这是否是由心碎引起的,我该怎么办

我的原始工作php代码:

if ($isSandbox) {   
        $endpoint = 'https://sandbox.itunes.apple.com/verifyReceipt';   
    }   
    else {   
        $endpoint = 'https://buy.itunes.apple.com/verifyReceipt';   
    }   
// Connect to Apple server and validate.
$postData = json_encode(array("receipt-data" => $receipt));
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded",
        'method'  => 'POST',
        'content' => $postData
    ),
);
$context  = stream_context_create($options);
$result = file_get_contents($endpoint, false, $context);

好吧,经过几个小时的搜索和检查,我终于明白了,发生了什么:

  1. 我把测试文件上传到另一台服务器,结果证明它正常工作不是php源代码问题
  2. 我添加了

    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    

    到php文件得到的错误代码是file-get-contents Couldn't resolve host name

  3. 所以我记得我昨天更新了所有的服务器软件处理心碎。似乎有一些更新修改了resolv.conf
  4. 我更改了resolv.conf添加了谷歌nameserver 8.8.8.8,但仍然无法工作
  5. 重新启动nginx和php-fpm,问题解决