1. Go to this page and download the library: Download restyler/amazon-scraper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use AmazonScraper\Client;
$amazonClient = new Client([
'rapidapi_key' => 'YOUR-RAPIDAPI-KEY'
]
);
$response = $amazonClient->getProductReviews([
'asin' => 'B07XQXZXJC',
'country' => 'US',
'page' => 1, // pagination starts from page#1
'sort_by' => 'recent' // 'recent' or 'helpful'
]);
echo json_encode($response);
/*
response will contain:
{
"total_reviews": 897,
"stars_stat": { "1": "8%", "2": "4%", "3": "7%", "4": "17%", "5": "63%" },
"result": [
{
"id": "R2BHM8R45IZZWS",
"asin": { "original": "B09295KQ9Q", "variant": "B09295GRFS" },
"review_data": "Reviewed in the United States on November 26, 2021",
"date": { "date": "November 26, 2021", "unix": 1637892000 },
"name": "Thomas Murcko",
"rating": 1,
"title": "Low quality phone",
"review": "The software on the phone is like something from 2008. Terrible phone if you need apps and browsing to function with out 5 second delays and freezing, oh and not doing what you need it to. Like loading apps or closing apps. Waste of money",
"verified_purchase": false
},
{
"id": "R186NHV1T171NC",
"asin": { "original": "B09295KQ9Q", "variant": "B09295GRFS" },
"review_data": "Reviewed in the United States on November 26, 2021",
"date": { "date": "November 26, 2021", "unix": 1637892000 },
"name": "Amazon Customer",
"rating": 5,
"title": "Best cheap phone I've owned.",
"review": "Nice cheap phone. Appears faster than it really is. High quality. Only one slight negative. It doesn't have wifi 5g. It does have 2.4g.",
"verified_purchase": true
},
{
"id": "RRN0QRM0NHHNP",
"asin": { "original": "B09295KQ9Q", "variant": "B09295GRFS" },
"review_data": "Reviewed in the United States on November 24, 2021",
"date": { "date": "November 24, 2021", "unix": 1637719200 },
"name": "l.johns",
"rating": 5,
"title": "Nice phone at a great price.",
"review": "The package arrived on time.So far, the phone works and it seems to be a nice phone.Also, got it at a great price.",
"verified_purchase": true
},
{
"id": "R1N9QQQEWZ57WT",
"asin": { "original": "B09295KQ9Q", "variant": "B09295GRFS" },
"review_data": "Reviewed in the United States on November 4, 2021",
"date": { "date": "November 4, 2021", "unix": 1635991200 },
"name": "SM",
"rating": 3,
"title": "Not as fast as my tcl10l",
"review": "I had my other TCL phone for about 6 months and it had an accident cracking the screen so I got this one as a quick replacement. I've had it for 3 days I'm not thrilled with it the apps on it have a lot of trouble when I'm out in public and not on Wi-Fi. My old TCL worked a lot faster as far as running apps or doing a Google search or something like that on the cellular data even though they were both unlocked phones this one just doesn't seem to have as great of a reception as the other one did. Picture quality on this phone and the other TCL are wonderful and definitely some of the best picture quality for the price.",
"verified_purchase": true
}
]
}
*/