1. Go to this page and download the library: Download s25/yandex-market-reviews 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/ */
s25 / yandex-market-reviews example snippets
25\Scrapping\YandexReviews;
use S25\HTTPClient\Client;
use S25\HTTPClient\UserAgent;
$client = new Client();
$client->setUserAgent(UserAgent::getRandom());
// Скачиваем страницу с отзывами
$result = $client->get('https://market.yandex.ru/shop--ozon-ru/443605/reviews');
$yandexReviews = new YandexReviews($result);
// 10 последних отзывов со страницы магазина
$reviews = $yandexReviews->getLastTenReviews();
// Кол-во оценок для 5,4,3,2,1 звёзд
$stars = $yandexReviews->getStars();
// Прочая информация со страницы отзывов
$summary = $yandexReviews->getSummaryRating();
print_r($reviews[5]);
print_r($stars);
print_r($summary);
$reviews = $yandexReviews->getLastTenReviews();
print_r($reviews);
Array
(
[id] => 87411609
[date] => 2019-02-18
[author] => dizstancia d.
[ratingValue] => 4
[img] => //avatars.mds.yandex.net/get-yapic/24700/26258836-1152698/islands-retina-middle
[delivery] => самовывоз
[city] => Ростов-на-Дону
[review] => Array
(
[positive] => Цена и оплата спасибо от сбербанк.
[negative] => Дорогая доставка до пункта выдачи.
[comment] => Хочется бесплатной доставки до пункта самовывоза.
)
)
more 9...
}