$http = new GuzzleHttp\Client([
'verify' => false,
]);
$clientId = 'client id';
$clientSecret = 'client secret';
$username = 'user email';
$password = 'password';
$response = $http->post('https://api.stnicholas-oca.org/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => $clientId,
'client_secret' => $clientSecret,
'username' => $username,
'password' => $password,
'scope' => '*',
],
]);
$responseData = json_decode((string) $response->getBody(), true);
$accessToken = $responseData['access_token'];
$googleId = 'com.tinder';
$response = $http->request('GET', 'https://api.stnicholas-oca.org/api/application/{$googleId}', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer '. $accessToken,
],
]);
$responseData = json_decode((string) $response->getBody(), true);
print_r($responseData);
$ids = [
'net.playq.charmking',
'com.nexon.maplem.global',
'com.square_enix.android_googleplay.khuxww',
'com.vizorapps.mahjong',
];
$ids = implode(',', $ids);
$response = $http->request('GET', "https://api.stnicholas-oca.org/api/applications/list?ids={$ids}", [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer '. $accessToken,
],
]);
$responseData = json_decode((string) $response->getBody(), true);
print_r($responseData);
[
[title] => Application Name
[description] => Description of application
[icon] => Url of icon
[rating] => 95.096521377563
[rating_count] => 675867
[payment] => $1.99
[categories] => [
[0] => [
[url] => /store/apps/category/GAME_ARCADE
[title] => Arcade
]
]
[developer] => [
[url] => /store/apps/developer?id=id
[title] => Developer Name
[site] => http://site.com
]
[screenshots] => [
[0] => Url 1
[1] => Url 2
]
[youtube] => Youtube url
[size] => 85M
[installs] => 1000000+
[version] => 2.111
[updated] => November 15, 2017
[os] => 4.0 and up
[interactive_element] => Users Interact
[content_rating_description] => Everyone
[is_game] => 1
[contains_ads] => 0
[marks] => {"1":11857,"2":0,"3":11857,"4":59287,"5":592866}
[support_email] => [email protected]
[policy] => http://site.com/privacy_policy.pdf
[address] => Address
// And other params
]
$response = $http->request('GET', 'https://api.stnicholas-oca.org/api/applications?page=1&per_page=10', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer '. $accessToken,
],
]);
$responseData = json_decode((string) $response->getBody(), true);
print_r($responseData);