heartbleed affect the 3rd party php server receipt verify of itunes?
-
20-12-2019 - |
質問
I have a working 3rd party php codes verify the receipt sent from ipad.
but it seems https://sandbox.itunes.apple.com/verifyReceipt no long response to my php code.
there's not even an error stat like {"status":21000}
if I visite the url directly.
I've tried different ways on server side, like curl_exec($ch); or file_get_contents
even the simple test get nothing returned at all.
$result = file_get_contents('https://sandbox.itunes.apple.com/verifyReceipt');
echo $result;
I wonder if this is caused by heartbleed and what can I do?
my original working php code:
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);
解決
Well, after hours searching and checking, I finally figure this out, here's what happened:
- I upload the test file to another server, turns out it's working so not a php source problem.
I added
error_reporting(E_ALL); ini_set('display_errors', '1');
to the php file got the error code is
file-get-contents Couldn't resolve host name
- so I remember I yum update all the server software yesterday to deal with heartbleed. and seems some update modified the resolv.conf.
- I changed the resolv.conf added google
nameserver 8.8.8.8
but still not working - restart the nginx and php-fpm, problem solved
所属していません StackOverflow