php - file_get_contents implements POST data, https
给我你的怀抱
给我你的怀抱 2017-05-27 17:42:27
0
3
561

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.

给我你的怀抱
给我你的怀抱

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!