有没有人做过php验证Apple store充值票据验证接口的问题
答案:2 悬赏:50 手机版
解决时间 2021-01-26 00:39
- 提问者网友:酱爆肉
- 2021-01-25 10:34
有没有人做过php验证Apple store充值票据验证接口的问题
最佳答案
- 五星知识达人网友:轻雾山林
- 2021-01-25 11:30
$receipt = preg_replace("/[^0-9a-fA-F]/","", $票据);
for($i = 0; $i < strlen($receipt); $i = $i + 2)
{
$ascii = $ascii.chr(hexdec(substr($temp, $i, 2)));
}
$param = array(
'receipt-data' => base64_encode($ascii),
); – 程序员
for($i = 0; $i < strlen($receipt); $i = $i + 2)
{
$ascii = $ascii.chr(hexdec(substr($temp, $i, 2)));
}
$param = array(
'receipt-data' => base64_encode($ascii),
); – 程序员
全部回答
- 1楼网友:渊鱼
- 2021-01-25 12:14
NVCI7Cn0=";
"environment" = "Sandbox";
"pod" = "100";
"signing-status" = "0";';
$param = array(
'receipt-data' => $str,
);
$receipt = json_encode($param);
// echo $receipt;
$url = "https://Sandbox.itunes.apple.com/verifyReceipt";
$defaults = array(
CURLOPT_POST => 1,//发送post请求
CURLOPT_HEADER => false,//是否返回请求头
CURLOPT_URL => $url,//url地址
CURLOPT_FRESH_CONNECT => 1,//强制获取一个新的连接,替代缓存中的连接
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 30,//请求超时时间
CURLOPT_SSL_VERIFYPEER => false,//cURL验证
CURLOPT_POSTFIELDS => $receipt
);
$ch = curl_init();
curl_setopt_array($ch,$defaults);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯