sxi*_*eng 5 php in-app-purchase ios
我正在使用php为iOS应用程序编写服务器.
我想通过访问Apple的appstore服务器来查看收据.
根据苹果的帮助文件.我必须向苹果的服务器发送一个帖子请求.
我怎么能用php做到这一点,非常感谢!
任何人都可以举个例子吗?
<?php
$applesharedsecret = "applesecretfromyourdevaccount";
$receiptbytes = "......applereceipt.......";
$appleurl = "https://buy.itunes.apple.com/verifyReceipt"; // for production
// use https://sandbox.itunes.apple.com/verifyReceipt for testing with sandbox receipt
$request = json_encode(array("receipt-data" => $receiptbytes,"password"=>$applesharedsecret));
$ch = curl_init($appleurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$jsonresult = curl_exec($ch);
curl_close($ch);
var_dump($jsonresult); // see the details of the receipt.
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6040 次 |
| 最近记录: |