PHP code example of hooshid / metacritic-scraper

1. Go to this page and download the library: Download hooshid/metacritic-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/ */

    

hooshid / metacritic-scraper example snippets

 php
$metacritic = new Hooshid\MetacriticScraper\Metacritic();
$extract = $metacritic->extract("/movie/the-matrix");
$result = $extract['result'];
$error = $extract['error'];

// get all available data as json
echo json_encode($extract);
 php
$metacritic = new Hooshid\MetacriticScraper\Metacritic();
$extract = $metacritic->extract("/tv/game-of-thrones");
$result = $extract['result'];
$error = $extract['error'];

if ($error) {
    echo $error;
} else {
    echo $result['type']; // type (movie, tv, game, person and ...)
    echo $result['title']; // movie/series title
    echo $result['thumbnail']; // Poster thumbnail
    echo $result['summary']; // Summary
    echo $result['release_year']; // Release year
    echo $result['must_see']; // Must see?
    
    echo $result['meta_score']; // Meta Score
    echo $result['meta_votes']; // Meta Votes
    echo $result['user_score']; // User Score
    echo number_format($result['user_votes']); // User Votes
}
 php
$metacritic = new Hooshid\MetacriticScraper\Metacritic();
$result = $metacritic->search("it");

// get all available data as json
echo json_encode($result);