Strict Standards: Non-static method InstagramScraper\Instagram::getLocationTopMediasById() should not be called statically in C:\OpenServer\domains\instagram\www\index.php on line 413
Fatal error: Using $this when not in object context in C:\OpenServer\domains\instagram\www\src\InstagramScraper\Instagram.php on line 449
Структура папок в OpenServer:
Вызов самой функции
$medias = Instagram::getLocationTopMediasById(1);
Сама функция
public function getLocationTopMediasById($facebookLocationId)
{
$response = Request::get(Endpoints::getMediasJsonByLocationIdLink($facebookLocationId), $this->generateHeaders($this->userSession));
if ($response->code === 404) {
throw new InstagramNotFoundException('Location with this id doesn\'t exist');
}
if ($response->code !== 200) {
throw new InstagramException('Response code is ' . $response->code . '. Body: ' . $response->body . ' Something went wrong. Please report issue.');
}
$cookies = self::parseCookies($response->headers['Set-Cookie']);
$this->userSession['csrftoken'] = $cookies['csrftoken'];
$jsonResponse = json_decode($response->raw_body, true);
$nodes = $jsonResponse['location']['top_posts']['nodes'];
$medias = [];
foreach ($nodes as $mediaArray) {
$medias[] = Media::fromTagPage($mediaArray);
}
return $medias;
}
Источник
библиотека