PHP code example of rl404 / mal-scraper

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

    

rl404 / mal-scraper example snippets



use MalScraper\MalScraper;

// Default (no caching, return array)
$myMalScraper = new MalScraper();

// Caching feature
$myMalScraper = new MalScraper([
    'enable_cache' => true,     // enable caching
    'cache_time' => 3600,       // (optional) caching time in seconds (1 day as default)
    'cache_path' => '../Cache/' // (optional) caching path (/src/MalScraper/Cache/ as default)
]);

// Return http response
$myMalScraper = new MalScraper([
    'to_api' => true,         	// convert return to http response
]);

$cowboyBebopInfo = $myMalScraper->getInfo('anime', 1);
print_r($cowboyBebopInfo);