Related
I know that similar threads exist, and I have tried to understand and read them all, but I'm not getting anywhere.
Problem: I'd like to output all the films directed by Stanley Kubrick and I want the movies to be listed in descending order by year of release.
The output of the films works, but I can't sort them.
"crew": [
{
"id": 45966,
"department": "Camera",
"original_language": "en",
"original_title": "Day of the Fight",
"job": "Director of Photography",
"overview": "American short subject documentary film in black-and-white, which is notable as the first picture directed by Stanley Kubrick. Kubrick financed the film himself, and it is based on an earlier photo feature he had done as a photographer for Look magazine in 1949. 'Day of the Fight' shows Irish-American middleweight boxer Walter Cartier during the height of his career, on the day of a fight with black middleweight Bobby James, which took place on April 17, 1950.",
"vote_count": 69,
"video": false,
"poster_path": "/4caX3IZkf7n2QCbxaJO3hyn0SCm.jpg",
"backdrop_path": "/lt1Lan9bmG29JjqaMad5tkRpCHJ.jpg",
"title": "Day of the Fight",
"popularity": 4.701,
"genre_ids": [
99
],
"vote_average": 5.9,
"adult": false,
"release_date": "1951-04-26",
"credit_id": "55d0b196c3a3681bff007bde"
},
{
"id": 10165,
"department": "Camera",
"original_language": "en",
"original_title": "Fear and Desire",
"job": "Director of Photography",
"overview": "After their airplane crashes behind enemy lines, four soldiers must survive and try to find a way back to their battalion. However, when they come across a local peasant girl the horrors of war quickly become apparent.",
"vote_count": 254,
"video": false,
"poster_path": "/oiN9OUOGbVywUHjto30AfLpnIJ7.jpg",
"backdrop_path": "/e3o0Dwlzzpd4kJpOOJgVyMstnII.jpg",
"title": "Fear and Desire",
"popularity": 6.052,
"genre_ids": [
18,
10752
],
"vote_average": 5.5,
"adult": false,
"release_date": "1953-04-01",
"credit_id": "55d0b9c392514131a5007a4c"
},
{
"id": 45314,
"department": "Camera",
"original_language": "en",
"original_title": "The Seafarers",
"job": "Director of Photography",
"overview": "Acclaimed director Stanley Kubrick's first film made in color. The documentary focuses on the benefits of membership to the Seafarers International Union.",
"vote_count": 44,
"video": false,
"release_date": "1953-10-15",
"vote_average": 4.7,
"title": "The Seafarers",
"popularity": 3.009,
"genre_ids": [
99
],
"backdrop_path": null,
"adult": false,
"poster_path": "/nSucFIAQ5CowEE1WZ87mz3OsbQ1.jpg",
"credit_id": "55d0cae1c3a36877570014d2"
},
{
"id": 975,
"department": "Camera",
"original_language": "en",
"original_title": "Paths of Glory",
"job": "Additional Photography",
"overview": "A commanding officer defends three scapegoats on trial for a failed offensive that occurred within the French Army in 1916.",
"vote_count": 1613,
"video": false,
"poster_path": "/peblNaHOiTR8DACYyUWsJHhK6GP.jpg",
"backdrop_path": "/yFykLiFuBU6CrGWr2hLP0ttbQ2i.jpg",
"title": "Paths of Glory",
"popularity": 11.573,
"genre_ids": [
18,
10752
],
"vote_average": 8.3,
"adult": false,
"release_date": "1957-09-18",
"credit_id": "5706f1259251412b1400065c"
},
{
"id": 45970,
"department": "Camera",
"original_language": "en",
"original_title": "Flying Padre",
"job": "Director of Photography",
"overview": "Two days in the life of priest Father Fred Stadtmuller whose New Mexico parish is so large he can only spread goodness and light among his flock with the aid of a mono-plane. The priestly pilot is seen dashing from one province to the next at the helm of his trusty Piper Club administering guidance (his plane, the Flying Padre) to unruly children, sermonizing at funerals and flying a sickly child and its mother to a hospital.",
"vote_count": 56,
"video": false,
"release_date": "1951-03-23",
"vote_average": 5.2,
"title": "Flying Padre",
"popularity": 4.033,
"genre_ids": [
99
],
"backdrop_path": "/5HisBYhc75h0DYXSMJWN1eFaxse.jpg",
"adult": false,
"poster_path": "/5aog5qVlMFakpogT1Nar9Z7gqq4.jpg",
"credit_id": "5e94991dccb15f001571103c"
},
{
"id": 10056,
"department": "Camera",
"original_language": "en",
"original_title": "Killer's Kiss",
"job": "Director of Photography",
"overview": "The film revolves around Davey Gordon, a 29 year old welterweight New York boxer in the end of his career, and his relationship with a dancer and her violent employer.",
"vote_count": 283,
"video": false,
"poster_path": "/jc5EjvQywJqS8Xm0RWMoblJvCM6.jpg",
"backdrop_path": "/6VhN0ScAA8VgK3qyRnZ7azD9XEV.jpg",
"title": "Killer's Kiss",
"popularity": 10.353,
"genre_ids": [
80,
18,
53
],
"vote_average": 6.4,
"adult": false,
"release_date": "1955-09-21",
"credit_id": "5e9499448e87020013ce555f"
},
{
"id": 185,
"department": "Directing",
"original_language": "en",
"original_title": "A Clockwork Orange",
"job": "Director",
"overview": "In a near-future Britain, young Alexander DeLarge and his pals get their kicks beating and raping anyone they please. When not destroying the lives of others, Alex swoons to the music of Beethoven. The state, eager to crack down on juvenile crime, gives an incarcerated Alex the option to undergo an invasive procedure that'll rob him of all personal agency. In a time when conscience is a commodity, can Alex change his tune?",
"vote_count": 8571,
"video": false,
"release_date": "1971-12-19",
"vote_average": 8.2,
"title": "A Clockwork Orange",
"popularity": 25.023,
"genre_ids": [
878,
18
],
"backdrop_path": "/keblhZFIZYiWflmURWNHEuS2jqL.jpg",
"adult": false,
"poster_path": "/4sHeTAp65WrSSuc05nRBKddhBxO.jpg",
"credit_id": "52fe4224c3a36847f80071db"
},
My code so far
$data = file_get_contents($url); // put the contents of the file into a variable
$director = json_decode($data); // decode the JSON feed
echo '<pre>';
print_r($director);
foreach ($director->crew as $showDirector) {
if ($showDirector->department == 'Directing') {
usort($showDirector, function ($item1, $item2) {
return $item2['release_date'] <=> $item1['release_date'];
});
echo $showDirector->release_date . ' / ' . $showDirector->title . '<br>';
}
}
usort gets passed the elements from the array exactly as they are. i.e. in this case your array contains objects - therefore you need to do the comparison on the properties of the objects and not as elements in an array.
Instead of comparing the items as array elements like this:
return $item2['release_date'] <=> $item1['release_date']);
...your function should be checking the object properties like this:
usort($showDirector, function ($item1, $item2) {
/* Check the release_date property of the objects passed in */
return $item2->release_date <=> $item1->release_date;
});
Also, you are also trying to sort the array in the wrong place - each time you find a director, you are sorting that single array (and there is only one element so nothing changes).
You need to:
Add all of the required director items into a separate array for sorting
When you have all items for sorting, you sort this array
Then you can loop through this sorted array to process the results, e.g. display them.
See the code below - the steps are commented so you can see what you need to do:
$data = file_get_contents($url); // put the contents of the file into a variable
$director = json_decode($data); // decode the JSON feed
/* 1. Create an array with the items you want to sort */
$directors_to_sort = array();
foreach ($director->crew as $showDirector) {
if ($showDirector->department == 'Directing') {
$directors_to_sort[] = $showDirector;
}
}
/* 2. Now sort those items
note, we compare the object properties instead of trying to use them as arrays */
usort($directors_to_sort, function ($item1, $item2) {
return $item2->release_date <=> $item1->release_date;
});
/* 3. Loop through the sorted array to display them */
foreach ($directors_to_sort as $director_to_display){
echo $director_to_display->release_date . ' / ' . $director_to_display->title . '<br>';
}
I have been on a little project of mine now i want to find imdb_id using tmdb_id so for that I have been trying to use the API.
https://api.themoviedb.org/3/tv/67026?api_key=myapikey&append_to_response=external_ids
which brings up the results like this
{
"backdrop_path": "/hcFbIbDzsB9aSSw9VkSGFEl5sGO.jpg",
"created_by": [{
"id": 230174,
"credit_id": "577eb8e5c3a368694a0027ac",
"name": "David Guggenheim",
"gender": 2,
"profile_path": "/hqSydaadHO6EsBIn3BQEzzfxNUY.jpg"
}],
"episode_run_time": [42],
"first_air_date": "2016-09-21",
"genres": [{
"id": 18,
"name": "Drama"
}, {
"id": 10768,
"name": "War & Politics"
}],
"homepage": "https://www.netflix.com/title/80113647",
"id": 67026,
"in_production": false,
"languages": ["en"],
"last_air_date": "2019-06-07",
"last_episode_to_air": {
"air_date": "2019-06-07",
"episode_number": 10,
"id": 1809432,
"name": "#truthorconsequences",
"overview": "On election day, Kirkman turns to his therapist to assuage his conscience about the events -- and his own decisions -- of the momentous prior 36 hours.",
"production_code": "",
"season_number": 3,
"show_id": 67026,
"still_path": "/cpy3uV100RyZuvJN535JLTrj4Nz.jpg",
"vote_average": 7.0,
"vote_count": 1
},
"name": "Designated Survivor",
"next_episode_to_air": null,
"networks": [{
"name": "ABC",
"id": 2,
"logo_path": "/ndAvF4JLsliGreX87jAc9GdjmJY.png",
"origin_country": "US"
}, {
"name": "Netflix",
"id": 213,
"logo_path": "/wwemzKWzjKYJFfCeiB57q3r4Bcm.png",
"origin_country": ""
}],
"number_of_episodes": 53,
"number_of_seasons": 3,
"origin_country": ["US"],
"original_language": "en",
"original_name": "Designated Survivor",
"overview": "Tom Kirkman, a low-level cabinet member is suddenly appointed President of the United States after a catastrophic attack during the State of the Union kills everyone above him in the Presidential line of succession.",
"popularity": 30.031,
"poster_path": "/5R125JAIh1N38pzHp2dRsBpOVNY.jpg",
"production_companies": [{
"id": 28788,
"logo_path": null,
"name": "Genre Films",
"origin_country": "US"
}, {
"id": 19366,
"logo_path": "/vOH8dyQhLK01pg5fYkgiS31jlFm.png",
"name": "ABC Studios",
"origin_country": "US"
}, {
"id": 78984,
"logo_path": null,
"name": "Entertainment 360",
"origin_country": "US"
}],
"seasons": [{
"air_date": "2016-09-20",
"episode_count": 21,
"id": 78328,
"name": "Season 1",
"overview": "Tom Kirkman, a low-level cabinet member is suddenly appointed President of the United States after a catastrophic attack during the State of the Union kills everyone above him in the Presidential line of succession.",
"poster_path": "/1QHlD6z9FnXuuTDVLJnjrtLfVyq.jpg",
"season_number": 1
}, {
"air_date": "2017-09-27",
"episode_count": 22,
"id": 91130,
"name": "Season 2",
"overview": "",
"poster_path": "/z4hdj8cYyqCO9lVBOGm6YZsnMho.jpg",
"season_number": 2
}, {
"air_date": "2019-06-07",
"episode_count": 10,
"id": 122914,
"name": "Season 3",
"overview": "",
"poster_path": "/wn310FWQhjjpHbqsMRBcXr28EHc.jpg",
"season_number": 3
}],
"status": "Canceled",
"type": "Scripted",
"vote_average": 7.2,
"vote_count": 408,
"external_ids": {
"imdb_id": "tt5296406",
"freebase_mid": null,
"freebase_id": null,
"tvdb_id": 311876,
"tvrage_id": 51115,
"facebook_id": "DesignatedSurvivor",
"instagram_id": "designatedsurvivor",
"twitter_id": "DesignatedNFLX"
}
}
So now if I want to get just the IMDb_ID form the external_ids then what code should i use in PHP and store it in a variable.
Thank you very much in advance.
use the json_decode method to treat JSON like a PHP object
$data = 'your JSON object';//raw data as string in $data
$decoded = json_decode($data);//decoded data as PHP object
echo $decoded->external_ids->imdb_id; //access any property you like
hope this helps!!!
I have a application running on ALEXA (Amazon Echo). I'm implementing Home card display with images. When for a particular call if the response has only one card. It shows perfectly fine. Screenshot attached
"Response": {
"version" : "1.0",
"sessionAttributes": {
"UserCityId": "1",
"UserCity": "London",
"latitude": "51.50735090",
"longitude": "-0.12775830",
"categoryID": "900",
"company_id": "1154916",
"first_name": "User FName",
"yes_no_for": "",
"cat_start_limit": "0",
"categoryName": "music",
"total_cat_events": "2178",
"show_rec": "5"
},
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "This is what alexa speaks out"
},
"card": {
"type": "Standard",
"title": "Music events in London",
"text": "The speech passed to alexa",
"image": {
"smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
"largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
}
},
"reprompt": {
"outputSpeech": {
"type": "PlainText",
"text": "Would you like to know events for music ,sports, or something else. Please select one category"
}
},
"shouldEndSession": false
}
}
The above code works
The problem is listed below :
But if the same response has array of cards (multiple cards), alexa fails giving an error.
"Response": {
"version": "1.0",
"sessionAttributes": {
"UserCityId": "1",
"UserCity": "London",
"latitude": "51.50735090",
"longitude": "-0.12775830",
"categoryID": "900",
"customer_id": "1154916",
"first_name": "UserFNAME",
"yes_no_for": "",
"cat_start_limit": "0",
"categoryName": "music",
"total_cat_events": "2178",
"show_rec": "5"
},
"response" : {
"outputSpeech" : {
"type": "PlainText",
"text": "5th. Baba Yaga's Hut Presents Jambinai, at Corsica Studios, on Monday, May 16th , 7 30 pm"
},
"card": [{
"type": "Standard",
"title": "Music events in London",
"text": "1. Dove Jones Blues Jam!, at Phoenix Artist Club, on Monday, May 16th , 7pm",
"image": {
"smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
"largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
}
}, {
"type": "Standard",
"title": "Music events in London",
"text": "2. The Hillbilly Moon Explosion, at The Borderline, on Monday, May 16th, 7pm",
"image": {
"smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
"largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
}
}, {
"type": "Standard",
"title": "Music events in London",
"text": "3. Sian Evans Of Kosheen, at 100 Club, on Monday, May 16th , 7 30 pm",
"image": {
"smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
"largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
}
}, {
"type": "Standard",
"title": "Music events in London",
"text": "4. Rinocerose, at The Water Rats, on Monday, May 16th , 7 30 pm",
"image": {
"smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
"largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
}
}, {
"type": "Standard",
"title": "Music events in London",
"text": "5. Baba Yaga's Hut Presents Jambinai, at Corsica Studios, on Monday, May 16th , 7 30 pm",
"image": {
"smallImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg",
"largeImageUrl": "https:\/\/xyz.com\/version\/sports-car-1374425_960_720.jpg"
}
}],
"reprompt": {
"outputSpeech": {
"type": "PlainText",
"text": "Would you like to know events for music ,sports, or something else. Please select one category"
}
},
"shouldEndSession" : false
}
}
The above code doesn't work.
Here is the thing that I'm trying to convert : Please see the screenshot
For events in london call I get list of 5 events in single card. To each event I want to assign image and create its card.
Can anyone help with the approach and figure out what is the problem using multiple card in JSON response.
Is it that alexa only support single card in response ?
The card attribute on the response takes an object not an array.
Here is the example that Amazon uses on their site:
{
"version": "string",
"sessionAttributes": {
"string": object
},
"response": {
"outputSpeech": {
"type": "string",
"text": "string",
"ssml": "string"
},
"card": {
"type": "string",
"title": "string",
"content": "string",
"text": "string",
"image": {
"smallImageUrl": "string",
"largeImageUrl": "string"
}
},
"reprompt": {
"outputSpeech": {
"type": "string",
"text": "string",
"ssml": "string"
}
},
"shouldEndSession": boolean
}
}
If you wanted to try and make multiple cards, you could try sending multiple responses, but I am not sure that that would work either.
I think your best option is to consider a different interaction with the user for your problem then presenting multiple cards.
I'm currently using the NYT News API to search for articles. I'm trying to get the Article Name, and URL from the JSON. How do I do this for each entry in the JSON?
$curl = curl_init();
$call = 'http://api.nytimes.com/svc/search/v2/articlesearch.json? q=Denmark&begin_date=20040112&end_date=20041212&sort=oldest&api-key=mykey';
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $call,
CURLOPT_USERAGENT => 'Codular Sample cURL Request'
));
// Send the request & save response to $resp
echo $resp = curl_exec($curl);
curl_close($curl);
//Decode Json
$y = json_decode($resp,true);
It returns a large JSON, I'm interested in retrieving the weburl, and headline field. I've tried:
$url = $y['response']['docs']['web_url']
and
$headline = $y['response']['docs']['headline']
but with no success. Any thoughts?
I also need all the entries that have a web_url and headline in the JSON.
A single article entry from the JSON response:
{
"response": {
"meta": {
"hits": 291,
"time": 102,
"offset": 0
},
"docs": [{
"web_url": "http://www.nytimes.com/2005/01/14/arts/design/14anti.html",
"snippet": "On Wednesday, Christie's New York is having what it claims is the first-ever auction devoted solely to Georg Jensen silver, with some 800 objects.",
"lead_paragraph": "Georg Jensen silver from Denmark has a tactile quality all its own, probably because it is handmade. It gets only better with age. Michael von Essen, the founder and curator of the Georg Jensen Museum in Copenhagen, tried to explain its appeal: ''Once you have touched pieces of Jensen, you want to have them. The silver has a warmth to it, whether the style is 1900, Art Deco or modern.'' Last year, the company Georg Jensen founded celebrated its 100th anniversary. Jensen, who was not a gifted businessman, would probably have been surprised.",
"abstract": "Wendy Moonan Antiques column profiles Danish silversmith Georg Jensen, whose company celebrated its centennial last year; Michael von Essen, founder and curator of Georg Jensen Museum in Copenhagen, is giving talk about Jensen at Christie's, comments; photo (M)",
"print_page": "41",
"blog": [],
"source": "The New York Times",
"multimedia": [],
"headline": {
"main": "From Denmark, Moonlight's Glow",
"kicker": "Antiques"
},
"keywords": [{
"name": "persons",
"value": "JENSEN, GEORG"
}, {
"name": "persons",
"value": "VON ESSEN, MICHAEL"
}, {
"name": "organizations",
"value": "CHRISTIE'S"
}, {
"name": "subject",
"value": "JEWELS AND JEWELRY"
}, {
"name": "subject",
"value": "ANTIQUES"
}, {
"name": "subject",
"value": "AUCTIONS"
}, {
"name": "subject",
"value": "ART"
}, {
"name": "subject",
"value": "SILVER"
}],
"pub_date": "2005-01-14T00:00:00Z",
"document_type": "article",
"news_desk": "Leisure/Weekend Desk",
"section_name": "Arts",
"subsection_name": null,
"byline": {
"person": [{
"organization": "",
"role": "reported",
"rank": 1,
"firstname": "Wendy",
"lastname": "Moonan"
}],
"original": "By Wendy Moonan"
},
"type_of_material": "News",
"_id": "4fd2a5708eb7c8105d88d3af",
"word_count": 1152,
"slideshow_credits": null
}]
},
"status": "OK",
"copyright": "Copyright (c) 2013 The New York Times Company. All Rights Reserved."
}
The Json Weburl data in the JSON can be accessed using the line: $y['response']['docs'][0]['web_url']
The 0 can be replaced with an index variable such as i to retrieve multiple web_url entries, and placed in a for loop.
for(i=0;i<3;i++)
{
$y['response']['docs'][i]['web_url']
}
I am developing a website where I need to display all the games related to iOS, play store and windows store. I have acquired iOS games & Windows games, but I am unable to acquire data related to android games.
I have tried various documentations mentioned in this link. But no use. Google is blocking most of them and others are not related to php.
Please suggest some latest working PHP API for extracting Google play store GAMES.
Thanks in advance.
You could try out SerpApi. We handle proxies, solve captchas, and parse all the rich structured data for you.
With the API you can extract everything you see on the Google Play Store page, including all of the reviews as well.
Example PHP code for retrieving results from GAMES category (available in other libraries also):
require 'path/to/google_search_results';
$query = [
"api_key" => "SECRET_API_KEY",
"engine" => "google_play",
"hl" => "en",
"store" => "apps",
"gl" => "us",
"apps_category" => "GAME"
];
$search = new GoogleSearch();
$results = $search->json($query);
Example JSON output:
{
"organic_results": [
{
"title": "Discover recommended games",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=ogoQCAESBEdBTUUqAggCUgIIAQ%3D%3D:S:ANO1ljJlEdM&gsr=ChOiChAIARIER0FNRSoCCAJSAggB:S:ANO1ljJdubc",
"see_more_token": "ChOiChAIARIER0FNRSoCCAJSAggB:S:ANO1ljJdubc",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=ChOiChAIARIER0FNRSoCCAJSAggB%3AS%3AANO1ljJdubc&store=apps",
"items": [
{
"title": "Roblox",
"link": "https://play.google.com/store/apps/details?id=com.roblox.client",
"product_id": "com.roblox.client",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.roblox.client&store=apps",
"rating": 4.4,
"extansion": {
"name": "Roblox Corporation",
"link": "https://play.google.com/store/apps/dev?id=5360036014478858866"
},
"thumbnail": "https://play-lh.googleusercontent.com/OCDxsiIIxiZL6ZQYcO9Sixv6Vxl9z0avSkpd5kS6SAE_ZU_V7_rlzzA0hsesT0Z4hA=s50-rw",
"images": [
"https://play-lh.googleusercontent.com/sM1bmvALGL6yYh_UnXomtkIgO9IzoVSi5Jbo9SIPcv9p73jR5S1Xz1K-0VFZwpkcgQ=w330-h185-rw"
]
},
...
]
},
{
"title": "New & updated games",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=SjYKKgokcHJvbW90aW9uXzMwMDA3OTFfbmV3X3JlbGVhc2VzX2dhbWVzEEoYAxIER0FNRToCCAI%3D:S:ANO1ljJYK2k&gsr=CjhKNgoqCiRwcm9tb3Rpb25fMzAwMDc5MV9uZXdfcmVsZWFzZXNfZ2FtZXMQShgDEgRHQU1FOgIIAg%3D%3D:S:ANO1ljICr10",
"see_more_token": "CjhKNgoqCiRwcm9tb3Rpb25fMzAwMDc5MV9uZXdfcmVsZWFzZXNfZ2FtZXMQShgDEgRHQU1FOgIIAg%3D%3D:S:ANO1ljICr10",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=CjhKNgoqCiRwcm9tb3Rpb25fMzAwMDc5MV9uZXdfcmVsZWFzZXNfZ2FtZXMQShgDEgRHQU1FOgIIAg%253D%253D%3AS%3AANO1ljICr10&store=apps",
"items": [
{
"title": "Subway Surfers",
"link": "https://play.google.com/store/apps/details?id=com.kiloo.subwaysurf",
"product_id": "com.kiloo.subwaysurf",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.kiloo.subwaysurf&store=apps",
"rating": 4.6,
"extansion": {
"name": "SYBO Games",
"link": "https://play.google.com/store/apps/dev?id=7363891306616760846"
},
"thumbnail": "https://play-lh.googleusercontent.com/N0cRWzreD-MT_IwcXKkK20Rzp10G1alWKGbw9McpfZ8Qa19SY-W3o0thOivS3BhZV4c=s50-rw",
"images": [
"https://play-lh.googleusercontent.com/i4h0nob9adP_bV7obHFJ0FSK2AwK2nGwSvml1Cudh0ni2U-Sb69wYuDzzCHFv6U3RX7T=w330-h185-rw"
]
},
...
]
},
{
"title": "Pre-registration games",
"subtitle": "Coming soon to Play",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=Sj0KMQorcHJvbW90aW9uXzMwMDAwMDBkNTFfcHJlX3JlZ2lzdHJhdGlvbl9nYW1lcxBKGAMSBEdBTUU6AggC:S:ANO1ljLVQMI&gsr=Cj9KPQoxCitwcm9tb3Rpb25fMzAwMDAwMGQ1MV9wcmVfcmVnaXN0cmF0aW9uX2dhbWVzEEoYAxIER0FNRToCCAI%3D:S:ANO1ljJICV4",
"see_more_token": "Cj9KPQoxCitwcm9tb3Rpb25fMzAwMDAwMGQ1MV9wcmVfcmVnaXN0cmF0aW9uX2dhbWVzEEoYAxIER0FNRToCCAI%3D:S:ANO1ljJICV4",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=Cj9KPQoxCitwcm9tb3Rpb25fMzAwMDAwMGQ1MV9wcmVfcmVnaXN0cmF0aW9uX2dhbWVzEEoYAxIER0FNRToCCAI%253D%3AS%3AANO1ljJICV4&store=apps",
"items": [
{
"title": "Diablo Immortal",
"link": "https://play.google.com/store/apps/details?id=com.blizzard.diablo.immortal",
"product_id": "com.blizzard.diablo.immortal",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.blizzard.diablo.immortal&store=apps",
"extansion": {
"name": "Blizzard Entertainment, Inc.",
"link": "https://play.google.com/store/apps/dev?id=8636572569301896616"
},
"thumbnail": "https://play-lh.googleusercontent.com/8DtlOHx-zIncYJE-kwHnOTBXycjAzwufkuk0uad7_MzWP17auA24THldTwhEru-b-7I=s50-rw",
"images": [
"https://play-lh.googleusercontent.com/IS3ExSTM5IskRgZQnF4RrTPUwh-D4TGlXdfahj33DGr-Y4CW55UpEeqyw6gazdpg-Q=w330-h185-rw"
]
},
...
]
},
...
},
"serpapi_pagination": {
"next": "https://serpapi.com/search.json?apps_category=GAME&engine=google_play&gl=us&hl=en&next_page_token=CsEBit_FqQO6AQgLENu_tbHXLxjbnqn8AxiCmMGOBRjprfD4Dhi_p5XjChij3diZBBjrr7AZGNzm9LsCGO3Y7eUCGMSuxcUFGKyKn6IJIIjZv3Iggf2anwEg_8m-igsgpY3k9gIggN_E5wsg6Kn7XyD_77mICiDe84i7AiDcu9vcCCDvosrNDyCGhuTFCyDKh_-IByDGsKfmCSCksMK5BSCQoczUBCDEoLO4CyDKm7-xCiC92tC9BSDl1tznASC-t4SMDBAK&store=apps",
"next_page_token": "CsEBit_FqQO6AQgLENu_tbHXLxjbnqn8AxiCmMGOBRjprfD4Dhi_p5XjChij3diZBBjrr7AZGNzm9LsCGO3Y7eUCGMSuxcUFGKyKn6IJIIjZv3Iggf2anwEg_8m-igsgpY3k9gIggN_E5wsg6Kn7XyD_77mICiDe84i7AiDcu9vcCCDvosrNDyCGhuTFCyDKh_-IByDGsKfmCSCksMK5BSCQoczUBCDEoLO4CyDKm7-xCiC92tC9BSDl1tznASC-t4SMDBAK"
}
}
Check out the documentation for more details.
Test the search live on the playground.
You can also get specific game results.
Example PHP code for retrieving Pokémon GO results:
require 'path/to/google_search_results';
$query = [
"api_key" => "SECRET_API_KEY",
"engine" => "google_play_product",
"store" => "apps",
"gl" => "us",
"product_id" => "com.nianticlabs.pokemongo"
];
$search = new GoogleSearch();
$results = $search->json($query);
Example JSON output:
{
"product_info": {
"title": "Pokémon GO",
"editors_choice": {
"link": "https://play.google.com/store/apps/editors_choice",
"thumbnail": "https://play-lh.googleusercontent.com/DGQjTn_Hp32i88g2YrbjrCwl0mqCPCzDjTwMkECh3wXyTv4y6zECR5VNbAH_At89jGgSJDQuSKsPSB-wVQ=s14-rw"
},
"authors": [
{
"name": "Niantic, Inc.",
"link": "https://play.google.com/store/apps/developer?id=Niantic,+Inc."
}
],
"categories": [
{
"name": "Adventure",
"link": "https://play.google.com/store/apps/category/GAME_ADVENTURE",
"category_id": "GAME_ADVENTURE",
"serpapi_link": "https://serpapi.com/search.json?apps_category=GAME_ADVENTURE&engine=google_play&gl=us&hl=en&store=apps"
}
],
"content_rating": {
"text": "Everyone",
"thumbnail": "https://play-lh.googleusercontent.com/IciOnDFecb5Xt50Q2jlcNC0LPI7LEGxNojroo-s3AozcyS-vDCwtq4fn7u3wZmRna8OewG9PBrWC-i7i=w56-h14-rw"
},
"rating": 4.3,
"reviews": 14951022,
"extansions": [
"Offers in-app purchases"
],
"thumbnail": "https://play-lh.googleusercontent.com/jRKLgsCxR-jPnDBogDgx2Vj2MXy0_jBhhEcGJmmCjSnScUYabjSLEyAvnCmwmiNBXw=s180-rw",
"offers": [
{
"text": "Install",
"link": "https://play.google.com/store/apps/details?id=com.nianticlabs.pokemongo&rdid=com.nianticlabs.pokemongo&feature=md&offerId"
}
],
"description": "New! Now you can battle other Pokémon GO Trainers online! Try the GO Battle League today!Join Trainers across the globe who are discovering Pokémon as they explore the world around them. Pokémon GO is the global gaming sensation that has been downloaded over 1 billion times and named “Best Mobile Game” by the Game Developers Choice Awards and “Best App of the Year” by TechCrunch._______________Uncover the world of Pokémon: Explore and discover Pokémon wherever you are! Catch more Pokémon to complete your Pokédex! Journey alongside your Buddy Pokémon to help make your Pokémon stronger and earn rewards!Compete in epic Gym battles and...Team up with other Trainers to catch powerful Pokémon during Raid Battles! It’s time to get moving—your real-life adventures await! Let’s GO!_______________Notes: - This app is free-to-play and offers in-game purchases. It is optimized for smartphones, not tablets.- Compatible with Android devices that have 2GB RAM or more and have Android Version 6.0–10.0+ installed.- Compatibility is not guaranteed for devices without GPS capabilities or devices that are connected only to Wi-Fi networks.- Application may not run on certain devices even if they have compatible OS versions installed.- It is recommended to play while connected to a network in order to obtain accurate location information.- Compatibility information may be changed at any time.- Please visit PokemonGO.com for additional compatibility information. - Information current as of October 20, 2020.Read moreCollapse"
},
"media": {
"video": {
"thumbnail": "https://play-lh.googleusercontent.com/KgDQ-Kjb2B7_jDP-8KmQDNhAmP2lqAV_w3zArOCBL7YZnQ02Qqp4VTlgdocO-4MFk4s=w720-h310-rw",
"link": "https://www.youtube.com/embed/DFXbVBFPOOs?ps=play&vq=large&rel=0&autohide=1&showinfo=0"
},
"images": [
"https://play-lh.googleusercontent.com/O-OR6Mh0AoNyiaYYaa3OJ_VHGfLqWW2qNzUUZxRRodD3fqs2Pm04FatavdNbz-jsMZM=w720-h310-rw",
...
]
},
"reviews": [
{
"title": "Aiden Cooper",
"avatar": "https://play-lh.googleusercontent.com/a-/AOh14GhjS7nHA19xmSqgW_7T3ngu5zTjDO46K9ZF--l33A",
"rating": 3,
"snippet": "Game is fun but a lot of features don't work correctly. One important example of this is Adventure Sync. I enable it and accept permissions, and I log off hoping it track throughout the day. I log on again, and it's recorded nothing at all, and says it's on. Then I log in again another time and it says it's off. Please fix this, it's very difficult to hatch eggs.",
"likes": 23,
"date": "November 29, 2021"
},
...
],
"what_s_new": {
"snippet": "Trainers, there’s always something new in Pokémon GO! - From November 5, 2021, to November 14, 2021, celebrate light overcoming darkness with an all-new event, Festival of Lights!- Visual changes have been added to indicate when either your Pokémon storage or Item Bag is full. The center of the Poké Ball menu icon will turn orange when your Pokémon storage is full and revert to gray when storage space is made available."
},
"additional_information": {
"updated": [
{
"snippet": "November 18, 2021"
}
],
"size": [
{
"snippet": "Varies with device"
}
],
"installs": [
{
"snippet": "100,000,000+"
}
],
"current_version": [
{
"snippet": "0.223.1"
}
],
"requires_android": [
{
"snippet": "6.0 and up"
}
],
"content_rating": [
{
"snippet": "EveryoneMild Fantasy ViolenceLearn more"
},
{
"snippet": "EveryoneMild Fantasy ViolenceLearn more"
},
{
"snippet": "Learn more",
"link": "https://support.google.com/googleplay?p=appgame_ratings"
}
],
"interactive_elements": [
{
"snippet": "In-Game Purchases"
}
],
"in_app_products": [
{
"snippet": "$0.99 - $99.99 per item"
}
],
"permissions": [
{
"snippet": "View details"
}
],
"report": [
{
"snippet": "Flag as inappropriate",
"link": "https://support.google.com/googleplay/?p=report_content"
}
],
"offered_by": [
{
"snippet": "Niantic, Inc."
}
],
"developer": [
{
"snippet": "Visit website",
"link": "https://niantic.helpshift.com/a/pokemon-go/?p=web"
},
{
"snippet": "pokemon-go-support#nianticlabs.com",
"link": "https://play.google.commailto:pokemon-go-support#nianticlabs.com"
},
{
"snippet": "Privacy Policy",
"link": "https://nianticlabs.com/privacy/pokemongo/en"
},
{
"snippet": "Visit websitepokemon-go-support#nianticlabs.comPrivacy PolicyOne Ferry Building, Suite 200 San Francisco, CA 94111"
}
]
},
"similar_results": [
{
"title": "Similar",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=ogonCBEqAggIMh8KGWNvbS5uaWFudGljbGFicy5wb2tlbW9uZ28QARgD:S:ANO1ljKcNx0&gsr=CiqiCicIESoCCAgyHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAM%3D:S:ANO1ljLVe3w",
"see_more_token": "CiqiCicIESoCCAgyHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAM%3D:S:ANO1ljLVe3w",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=CiqiCicIESoCCAgyHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAM%253D%3AS%3AANO1ljLVe3w&store=apps",
"items": [
{
"title": "Slugterra: Slug it Out 2",
"link": "https://play.google.com/store/apps/details?id=com.dhxmedia.slugitout2",
"product_id": "com.dhxmedia.slugitout2",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.dhxmedia.slugitout2&store=apps",
"description": "Pick up Greneater, Aquafreak, and Nightgeist in the Ghoul Slug Pack!",
"rating": 4.7,
"extansion": {
"name": "Epic Story Interactive",
"link": "https://play.google.com/store/apps/dev?id=5905438781451669270"
},
"thumbnail": "https://play-lh.googleusercontent.com/PgphCA3N_CSH_mLekZ_0RHiXS7FOUSlZdaCIwmEGZ2Q7I4eJkJVvYSb6Q3Lt8YP3LPZf=s128-rw"
},
...
]
},
{
"title": "More by Niantic, Inc.",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=igM-ChkKEzc2MzI0NjkyNzI0MzEyMjQxMjkQCBgDEh8KGWNvbS5uaWFudGljbGFicy5wb2tlbW9uZ28QARgDGAE%3D:S:ANO1ljJ8G8M&gsr=CkGKAz4KGQoTNzYzMjQ2OTI3MjQzMTIyNDEyORAIGAMSHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAMYAQ%3D%3D:S:ANO1ljKQOY4",
"see_more_token": "CkGKAz4KGQoTNzYzMjQ2OTI3MjQzMTIyNDEyORAIGAMSHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAMYAQ%3D%3D:S:ANO1ljKQOY4",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=CkGKAz4KGQoTNzYzMjQ2OTI3MjQzMTIyNDEyORAIGAMSHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAMYAQ%253D%253D%3AS%3AANO1ljKQOY4&store=apps",
"items": [
{
"title": "Pikmin Bloom",
"link": "https://play.google.com/store/apps/details?id=com.nianticlabs.pikmin",
"product_id": "com.nianticlabs.pikmin",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.nianticlabs.pikmin&store=apps",
"description": "Make every step count!",
"rating": 3.6,
"extansion": {
"name": "Niantic, Inc.",
"link": "https://play.google.com/store/apps/developer?id=Niantic,+Inc."
},
"thumbnail": "https://play-lh.googleusercontent.com/lZhO5dn3aCCBkqfFBMCFQeTsCaCfKA_wdmXsco4HtZoy970MSPnXTSbm5Ub-Z3glHA=s128-rw"
},
...
]
}
],
}
Check out the documentation for more details.
Test the search live on the playground.
Disclaimer: I work at SerpApi.
there is a api on API,
i'm using that api to fetch app info from play store..
u have to pass only package name of app & your srcret key (this is generated when you register on that site)