我有以下代码:
<?php
$ids = 'ids=com.hugogames.hugotrollwars';
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $ids
)
);
$context = stream_context_create($opts);
$result = file_get_contents('https://play.google.com/store/xhr/getdoc', false,
$context);
$convert = explode("\n", $result);
基本上它从 Playstore 中提取权限并将其显示为字符串。我遇到的问题是删除不需要的数据(图像链接、描述)并且只显示权限和权限描述。我尝试在 php 中使用 json_decode 函数,但它返回了 NULL。
有什么我想念的吗?
非常感谢任何帮助!
最佳答案
$result 不是有效的 json。 Google Play API 使用的是 protobuf 变体。
http://www.segmentationfault.fr/publications/reversing-google-play-and-micro-protobuf-applications/
还有 php 库可以与 google play 对话。
关于php - 使用 PHP 格式化 JSON 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22134494/