Pretty simple with Composer, run:
composer require anime-db/world-art-browser-bundle
Add AnimeDbWorldArtBrowserBundle to your application kernel
// app/appKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new AnimeDb\Bundle\WorldArtBrowserBundle\AnimeDbWorldArtBrowserBundle(),
);
}
anime_db_world_art_browser:
# Host name
# As a default used 'http://www.world-art.ru'
host: 'http://www.world-art.ru'
# HTTP User-Agent
# No default value
client: 'My Custom Bot 1.0'
First get browser
$browser = $this->get('anime_db.world_art.browser');
Get info for anime Akira:
$content = $browser->get('/animation/animation.php?id=1');
Catch exceptions
use AnimeDb\Bundle\WorldArtBrowserBundle\Exception\BannedException;
use AnimeDb\Bundle\WorldArtBrowserBundle\Exception\NotFoundException;
try {
$content = $browser->get('/animation/animation.php?id=1');
} catch (BannedException $e) {
// you are banned
} catch (NotFoundException $e) {
// page not found
} catch (\Exception $e) {
// other exceptions
}
You can customize request options. See Guzzle Documentation.
This bundle is under the GPL v3 license. See the complete license in the file: LICENSE