0
Google PlayデベロッパーAPIでPHPを使用して、偽造トランザクションに対してアプリ内購入を保護し、検証したいと考えています。私はこれについてGoogle Docsを見直しました。私は最初にこのリンクhttps://developers.google.com/android-publisher/authorizationの手順を完了してaccess_tokenを作成しました。それから私はこのリンクhttps://developers.google.com/android-publisher/api-ref/purchases/products/get#authで説明されているアクションを実行しようとしましたが、失敗しました。私のコードと私が得た結果は次のとおりです。PHPを使用したGoogle PlayデベロッパーAPI
マイコード:
<?php
$curl = curl_init();
$headers = array(
'access_token: my_access_token',
'expires_in: 3600',
'token_type: Bearer'
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_URL, "https://www.googleapis.com/androidpublisher/v2/applications/my.package.name/purchases/products/myProductId/tokens/myPurchaseToken");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($curl);
echo $result;
curl_close($curl);
?>
結果:
私が間違っているの{
error: {
errors: [
{
domain: "global",
reason: "required",
message: "Login Required",
locationType: "header",
location: "Authorization"
}
],
code: 401,
message: "Login Required"
}
}
、私は何をすべきでしょうか?今からありがとう。