As the title states, regardless of the curl method, POST is given to the interface data, but the interface cannot obtain it or there is a problem with returning parameters.
Post the code:
$POSTFIELDS = array("receipt-data" => $receipt_data); //
$POSTFIELDS = json_encode($POSTFIELDS); // 注释了也没用
$url = "https://sandbox.itunes.apple.com/verifyReceipt";
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => "Content-type: application/x-www-form-urlencoded",
'content' => http_build_query($POSTFIELDS),
'timeout' => 20,
)
));
return file_get_contents($url, false, $context);
$receipt_data data format is correct because curl testing can return correct information.
But for file, the returned parameters are always wrong no matter what. I don’t know what the problem is.
What you said upstairs is correct. Regarding this problem, it is actually an error when interacting with the Apple payment interface and transmitting data.
http_build_query is not required
Let’s first see what the server gets. . . Are you passing json? Then there is the POST in form format. . . Without key=>value, the backend can only get strings in json format
HTTPS needs to enable SSL
Get this to help you
http://www.jb51.net/article/4...