xxs18326183038
xxs18326183038
2021-01-19 09:58

php 苹果内购验证凭证请求超时

  • php

PHP请求苹果验证凭证接口返回很慢,要十几秒,甚至有时候会超时,有没有大佬做过这个验证的,知道什么原因么

$params = array("receipt-data" => "MII6iAYJKoZIhvcNAQcCoII6eTCCOn",
            "password"=>"*******"
        );
        $params = json_encode($params);
        $ios_verify_url = 'https://sandbox.itunes.apple.com/verifyReceipt';//测试环境
        $ch = curl_init($ios_verify_url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);  //这两行一定要加,不加会报SSL 错误
        curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
        $result = curl_exec($ch);
        curl_close($ch);
        ps($result);

 

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答

为你推荐

换一换