PHP code example of dood / afisha-crawler

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

    

dood / afisha-crawler example snippets


$crawler = new Crawler;
$fetcher = new GuzzleFetcher;

$coliseum = new P24('https://api.kinobilety.net/api', $fetcher);
$coliseum->setMarket('698');

$kino = clone $coliseum;
$kino->setMarket('1');

$kinomax = new Kinomax('https://kinomax.ru', $fetcher);

$result = $crawler
    ->addParser($kino)
    ->addParser($coliseum)
    ->addParser($kinomax)
    ->fetchAsync();

$result = Crawler::mergeDuplicates(
    array_reduce($result, 'array_merge', []));

var_dump($result);